Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
web-apps
Commits
beb9ffe3
Commit
beb9ffe3
authored
Dec 26, 2016
by
Alexander Yuzhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/new-mobile' of
https://github.com/ONLYOFFICE/web-apps
into feature/new-mobile
parents
ae634737
878144e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
126 deletions
+152
-126
apps/spreadsheeteditor/mobile/app/controller/CellEditor.js
apps/spreadsheeteditor/mobile/app/controller/CellEditor.js
+1
-1
apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js
...spreadsheeteditor/mobile/app/controller/DocumentHolder.js
+147
-118
apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js
apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js
+4
-7
No files found.
apps/spreadsheeteditor/mobile/app/controller/CellEditor.js
View file @
beb9ffe3
...
...
@@ -76,7 +76,7 @@ define([
// this.api.isCEditorFocused = false;
this
.
api
.
asc_registerCallback
(
'
asc_onSelectionNameChanged
'
,
_
.
bind
(
this
.
onApiCellSelection
,
this
));
//
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
this
.
api
.
asc_registerCallback
(
'
asc_onEditCell
'
,
_
.
bind
(
this
.
onApiEditCell
,
this
));
// this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiDisconnect,this));
// Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this));
// Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
...
...
apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js
View file @
beb9ffe3
...
...
@@ -48,8 +48,15 @@ define([
SSE
.
Controllers
.
DocumentHolder
=
Backbone
.
Controller
.
extend
((
function
()
{
// private
var
_stack
,
_isEdit
=
false
;
var
_isEdit
=
false
;
function
openLink
(
url
)
{
var
newDocumentPage
=
window
.
open
(
url
,
'
_blank
'
);
if
(
newDocumentPage
)
{
newDocumentPage
.
focus
();
}
}
return
{
models
:
[],
...
...
@@ -69,8 +76,8 @@ define([
setApi
:
function
(
api
)
{
this
.
api
=
api
;
//
this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this));
//
this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this));
this
.
api
.
asc_registerCallback
(
'
asc_onShowPopMenu
'
,
_
.
bind
(
this
.
onApiShowPopMenu
,
this
));
this
.
api
.
asc_registerCallback
(
'
asc_onHidePopMenu
'
,
_
.
bind
(
this
.
onApiHidePopMenu
,
this
));
},
setMode
:
function
(
mode
)
{
...
...
@@ -88,33 +95,48 @@ define([
// Handlers
onContextMenuClick
:
function
(
view
,
event
Name
)
{
onContextMenuClick
:
function
(
view
,
event
)
{
var
me
=
this
;
if
(
'
cut
'
==
eventName
)
{
me
.
api
.
asc_Cut
();
}
else
if
(
'
copy
'
==
eventName
)
{
me
.
api
.
asc_Copy
()
;
}
else
if
(
'
paste
'
==
eventName
)
{
me
.
api
.
asc_Paste
()
;
}
else
if
(
'
delete
'
==
eventName
)
{
console
.
debug
(
'
IMPLEMENT: Delete fragment
'
)
;
}
else
if
(
'
edit
'
==
eventName
)
{
var
info
=
me
.
api
.
asc_getCellInfo
();
switch
(
event
)
{
case
'
cut
'
:
me
.
api
.
asc_Cut
();
break
;
case
'
copy
'
:
me
.
api
.
asc_Copy
();
break
;
case
'
paste
'
:
me
.
api
.
asc_Paste
();
break
;
case
'
del
'
:
me
.
api
.
asc_emptyCells
(
Asc
.
c_oAscCleanOptions
.
All
);
break
;
case
'
wrap
'
:
me
.
api
.
asc_setCellTextWrap
(
true
);
break
;
case
'
unwrap
'
:
me
.
api
.
asc_setCellTextWrap
(
false
);
break
;
case
'
edit
'
:
me
.
view
.
hideMenu
();
SSE
.
getController
(
'
EditContainer
'
).
showModal
();
}
else
if
(
'
addlink
'
==
eventName
)
{
SSE
.
getController
(
'
AddContainer
'
).
showModal
();
// SSE.getController('EditCell').getView('EditCell');
break
;
case
'
merge
'
:
if
(
me
.
api
.
asc_mergeCellsDataLost
(
Asc
.
c_oAscMergeOptions
.
Merge
))
{
uiApp
.
confirm
(
me
.
warnMergeLostData
,
undefined
,
function
(){
me
.
api
.
asc_mergeCells
(
Asc
.
c_oAscMergeOptions
.
Merge
);
});
}
else
{
me
.
api
.
asc_mergeCells
(
Asc
.
c_oAscMergeOptions
.
Merge
);
}
break
;
case
'
unmerge
'
:
me
.
api
.
asc_mergeCells
(
Asc
.
c_oAscMergeOptions
.
Unmerge
);
break
;
case
'
addlink
'
:
me
.
view
.
hideMenu
();
SSE
.
getController
(
'
AddContainer
'
).
showModal
();
SSE
.
getController
(
'
AddOther
'
).
getView
(
'
AddOther
'
).
showLink
();
}
else
if
(
'
openlink
'
==
eventName
)
{
_
.
some
(
_stack
,
function
(
item
)
{
if
(
item
.
get_ObjectType
()
==
Asc
.
c_oAscTypeSelectElement
.
Hyperlink
)
{
me
.
_openLink
(
item
.
get_ObjectValue
().
get_Value
());
return
true
;
SSE
.
getController
(
'
AddOther
'
).
getView
(
'
AddOther
'
).
showInsertLink
();
break
;
case
'
openlink
'
:
var
linkinfo
=
info
.
asc_getHyperlink
();
if
(
linkinfo
.
asc_getType
()
==
Asc
.
c_oAscHyperlinkType
.
RangeLink
)
{
/* not implemented in sdk */
}
else
{
var
url
=
linkinfo
.
asc_getHyperlinkUrl
().
replace
(
/
\s
/g
,
"
%20
"
);
me
.
api
.
asc_getUrlType
(
url
)
>
0
&&
openLink
(
url
);
}
})
;
break
;
}
me
.
view
.
hideMenu
();
...
...
@@ -127,6 +149,8 @@ define([
},
onApiShowPopMenu
:
function
(
posX
,
posY
)
{
// if ( !this.permitions.isEdit ) return;
if
(
$
(
'
.popover.settings, .popup.settings, .picker-modal.settings
'
).
length
>
0
)
{
return
;
}
...
...
@@ -134,10 +158,9 @@ define([
var
me
=
this
,
items
;
_stack
=
me
.
api
.
getSelectedElements
();
items
=
me
.
_initMenu
(
_stack
);
items
=
me
.
_initMenu
(
me
.
api
.
asc_getCellInfo
());
me
.
view
.
showMenu
(
items
,
posX
,
posY
);
me
.
view
.
showMenu
(
items
,
posX
+
200
,
posY
+
100
);
},
onApiHidePopMenu
:
function
()
{
...
...
@@ -146,104 +169,108 @@ define([
// Internal
_openLink
:
function
(
url
)
{
if
(
this
.
api
.
asc_getUrlType
(
url
)
>
0
)
{
var
newDocumentPage
=
window
.
open
(
url
,
'
_blank
'
);
if
(
newDocumentPage
)
{
newDocumentPage
.
focus
();
}
}
},
_initMenu
:
function
(
stack
)
{
var
me
=
this
,
menuItems
=
[],
canCopy
=
me
.
api
.
can_CopyCut
();
_initMenu
:
function
(
cellinfo
)
{
var
me
=
this
;
if
(
canCopy
)
{
menuItems
.
push
(
{
if
(
this
.
api
.
isCellEdited
)
{
menuItems
=
[
{
caption
:
'
Copy
'
,
event
:
'
copy
'
});
}
}];
var
isText
=
false
,
isTable
=
false
,
isImage
=
false
,
isChart
=
false
,
isShape
=
false
,
isLink
=
false
;
_
.
each
(
stack
,
function
(
item
)
{
var
objectType
=
item
.
get_ObjectType
(),
objectValue
=
item
.
get_ObjectValue
();
if
(
objectType
==
Asc
.
c_oAscTypeSelectElement
.
Text
)
{
isText
=
true
;
}
else
if
(
objectType
==
Asc
.
c_oAscTypeSelectElement
.
Image
)
{
if
(
objectValue
&&
objectValue
.
get_ChartProperties
())
{
isChart
=
true
;
}
else
if
(
objectType
&&
objectValue
.
get_ShapeProperties
())
{
isShape
=
true
;
}
else
{
isImage
=
true
;
}
}
else
if
(
objectType
==
Asc
.
c_oAscTypeSelectElement
.
Table
)
{
isTable
=
true
;
}
else
if
(
objectType
==
Asc
.
c_oAscTypeSelectElement
.
Hyperlink
)
{
isLink
=
true
;
}
});
if
(
stack
.
length
>
0
)
{
var
topObject
=
stack
[
stack
.
length
-
1
],
topObjectType
=
topObject
.
get_ObjectType
(),
topObjectValue
=
topObject
.
get_ObjectValue
(),
objectLocked
=
_
.
isFunction
(
topObjectValue
.
get_Locked
)
?
topObjectValue
.
get_Locked
()
:
false
;
var
swapItems
=
function
(
items
,
indexBefore
,
indexAfter
)
{
items
[
indexAfter
]
=
items
.
splice
(
indexBefore
,
1
,
items
[
indexAfter
])[
0
];
};
if
(
!
objectLocked
&&
_isEdit
)
{
menuItems
.
push
({
var
menuItems
=
[
{
caption
:
'
Cut
'
,
event
:
'
cut
'
});
menuItems
.
push
({
},
{
caption
:
'
Copy
'
,
event
:
'
copy
'
},
{
caption
:
'
Paste
'
,
event
:
'
paste
'
});
// Swap 'Copy' and 'Cut'
swapItems
(
menuItems
,
0
,
1
);
}
];
var
iscellmenu
,
isrowmenu
,
iscolmenu
,
isallmenu
,
ischartmenu
,
isimagemenu
,
istextshapemenu
,
isshapemenu
,
istextchartmenu
,
seltype
=
cellinfo
.
asc_getFlags
().
asc_getSelectionType
(),
iscelllocked
=
cellinfo
.
asc_getLocked
(),
isTableLocked
=
cellinfo
.
asc_getLockedTable
()
===
true
;
switch
(
seltype
)
{
case
Asc
.
c_oAscSelectionType
.
RangeCells
:
iscellmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeRow
:
isrowmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeCol
:
iscolmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeMax
:
isallmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeImage
:
isimagemenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeShape
:
isshapemenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeChart
:
ischartmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeChartText
:
istextchartmenu
=
true
;
break
;
case
Asc
.
c_oAscSelectionType
.
RangeShapeText
:
istextshapemenu
=
true
;
break
;
}
if
(
isimagemenu
||
isshapemenu
||
ischartmenu
)
{
menuItems
.
push
({
caption
:
'
Edit
'
,
event
:
'
edit
'
});
}
else
if
(
istextshapemenu
||
istextchartmenu
)
{
}
else
{
if
(
iscellmenu
)
{
!
iscelledited
&&
menuItems
.
push
({
caption
:
'
Delete
'
,
event
:
'
delete
'
event
:
'
del
'
});
!
iscelllocked
&&
menuItems
.
push
({
caption
:
'
Edit
'
,
caption
:
'
Cell
'
,
event
:
'
edit
'
});
}
var
text
=
me
.
api
.
can_AddHyperlink
();
menuItems
.
push
({
caption
:
'
Merge
'
,
event
:
'
merge
'
});
if
(
!
_
.
isEmpty
(
text
))
{
cellinfo
.
asc_getFlags
().
asc_getMerge
()
&&
menuItems
.
push
({
caption
:
'
Add Link
'
,
event
:
'
addlink
'
caption
:
'
Unmerge
'
,
event
:
'
unmerge
'
});
menuItems
.
push
(
cellinfo
.
asc_getFlags
().
asc_getWrapText
()
?
{
caption
:
'
Unwrap
'
,
event
:
'
unwrap
'
}
:
{
caption
:
'
Wrap
'
,
event
:
'
wrap
'
});
}
if
(
isLink
)
{
if
(
cellinfo
.
asc_getHyperlink
()
&&
!
iscelledited
&&
!
cellinfo
.
asc_getFlags
().
asc_getMultiselect
()
&&
cellinfo
.
asc_getHyperlink
().
asc_getType
()
==
Asc
.
c_oAscHyperlinkType
.
WebLink
)
{
menuItems
.
push
({
caption
:
'
Open Link
'
,
event
:
'
openlink
'
});
}
else
if
(
!
cellinfo
.
asc_getHyperlink
()
&&
!
iscelledited
&&
!
cellinfo
.
asc_getFlags
().
asc_getMultiselect
()
&&
!
cellinfo
.
asc_getFlags
().
asc_getLockText
()
&&
!!
cellinfo
.
asc_getText
()
)
{
menuItems
.
push
({
caption
:
'
Add Link
'
,
event
:
'
addlink
'
});
}
}
}
}
...
...
@@ -252,7 +279,9 @@ define([
}
return
menuItems
;
}
},
warnMergeLostData
:
'
Operation can destroy data in the selected cells.<br>Continue?
'
}
})());
});
\ No newline at end of file
apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js
View file @
beb9ffe3
...
...
@@ -60,17 +60,15 @@ define([
// Set innerHTML and get the references to the DOM elements
initialize
:
function
()
{
//
Common
.
NotificationCenter
.
on
(
'
document:ready
'
,
function
()
{
this
.
$el
.
append
(
this
.
template
());
}.
bind
(
this
));
},
// Render layout
render
:
function
()
{
var
el
=
$
(
this
.
el
);
el
.
append
(
this
.
template
({
//
}));
// this.f7View = uiApp.addView('.view-main', {
// // params
// });
...
...
@@ -121,8 +119,7 @@ define([
hideMenu
:
function
()
{
$
(
'
#
'
+
_anchorId
)
.
css
(
'
left
'
,
-
1000
)
.
css
(
'
top
'
,
-
1000
);
.
css
({
'
left
'
:
-
1000
,
'
top
'
:
-
1000
});
uiApp
.
closeModal
(
'
.document-menu.modal-in
'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment