2016-11-11 13:24:21 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-11-11 13:24:21 +00:00
*
* This program is a free software product . You can redistribute it and / or
* modify it under the terms of the GNU Affero General Public License ( AGPL )
* version 3 as published by the Free Software Foundation . In accordance with
* Section 7 ( a ) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non - infringement
* of any third - party rights .
*
* This program is distributed WITHOUT ANY WARRANTY ; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . For
* details , see the GNU AGPL at : http : //www.gnu.org/licenses/agpl-3.0.html
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-11-11 13:24:21 +00:00
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
/ * *
* DocumentHolder . js
* Document Editor
*
* Created by Alexander Yuzhin on 11 / 8 / 16
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-11-11 13:24:21 +00:00
*
* /
define ( [
'core' ,
2016-12-21 16:16:25 +00:00
'jquery' ,
'underscore' ,
'backbone' ,
2016-12-28 11:06:13 +00:00
'documenteditor/mobile/app/view/DocumentHolder' ,
'common/main/lib/collection/Users'
2016-12-21 16:16:25 +00:00
] , function ( core , $ , _ , Backbone ) {
2016-11-11 13:24:21 +00:00
'use strict' ;
2016-11-17 12:24:27 +00:00
DE . Controllers . DocumentHolder = Backbone . Controller . extend ( _ . extend ( ( function ( ) {
2016-11-11 13:24:21 +00:00
// private
2016-11-14 10:35:47 +00:00
var _stack ,
2016-12-21 16:16:25 +00:00
_view ,
2016-12-28 11:06:13 +00:00
_fastCoAuthTips = [ ] ,
2017-04-11 11:05:56 +00:00
_actionSheets = [ ] ,
2019-02-15 10:35:53 +00:00
_isEdit = false ,
2019-05-24 08:43:15 +00:00
_canReview = false ,
2019-02-15 10:35:53 +00:00
_inRevisionChange = false ,
2020-03-05 11:20:04 +00:00
_isComments = false ,
2019-03-14 10:13:13 +00:00
_menuPos = [ ] ,
_timer = 0 ;
2016-11-11 13:24:21 +00:00
return {
models : [ ] ,
2016-12-28 11:06:13 +00:00
collections : [
'Common.Collections.Users'
] ,
2016-11-11 13:24:21 +00:00
views : [
'DocumentHolder'
] ,
initialize : function ( ) {
this . addListeners ( {
'DocumentHolder' : {
'contextmenu:click' : this . onContextMenuClick
}
} ) ;
} ,
setApi : function ( api ) {
2016-12-21 16:16:25 +00:00
var me = this ;
me . api = api ;
2016-11-11 13:24:21 +00:00
2016-12-28 11:06:13 +00:00
me . api . asc _registerCallback ( 'asc_onShowPopMenu' , _ . bind ( me . onApiShowPopMenu , me ) ) ;
me . api . asc _registerCallback ( 'asc_onHidePopMenu' , _ . bind ( me . onApiHidePopMenu , me ) ) ;
me . api . asc _registerCallback ( 'asc_onShowForeignCursorLabel' , _ . bind ( me . onApiShowForeignCursorLabel , me ) ) ;
me . api . asc _registerCallback ( 'asc_onHideForeignCursorLabel' , _ . bind ( me . onApiHideForeignCursorLabel , me ) ) ;
me . api . asc _registerCallback ( 'asc_onAuthParticipantsChanged' , _ . bind ( me . onApiUsersChanged , me ) ) ;
me . api . asc _registerCallback ( 'asc_onConnectionStateChanged' , _ . bind ( me . onApiUserConnection , me ) ) ;
2017-02-03 08:42:53 +00:00
me . api . asc _registerCallback ( 'asc_onDocumentContentReady' , _ . bind ( me . onApiDocumentContentReady , me ) ) ;
2017-11-23 09:01:27 +00:00
Common . NotificationCenter . on ( 'api:disconnect' , _ . bind ( me . onCoAuthoringDisconnect , me ) ) ;
2018-05-23 11:43:30 +00:00
me . api . asc _registerCallback ( 'asc_onCoAuthoringDisconnect' , _ . bind ( me . onCoAuthoringDisconnect , me ) ) ;
2019-02-15 10:35:53 +00:00
me . api . asc _registerCallback ( 'asc_onShowRevisionsChange' , _ . bind ( me . onApiShowChange , me ) ) ;
2020-03-05 11:20:04 +00:00
me . api . asc _registerCallback ( 'asc_onShowComment' , _ . bind ( me . onApiShowComment , me ) ) ;
me . api . asc _registerCallback ( 'asc_onHideComment' , _ . bind ( me . onApiHideComment , me ) ) ;
2016-12-28 11:06:13 +00:00
me . api . asc _coAuthoringGetUsers ( ) ;
2016-11-11 13:24:21 +00:00
} ,
setMode : function ( mode ) {
2017-05-25 09:55:29 +00:00
_isEdit = mode . isEdit ;
2019-05-24 08:43:15 +00:00
_canReview = mode . canReview ;
2016-11-11 13:24:21 +00:00
} ,
// When our application is ready, lets get started
onLaunch : function ( ) {
var me = this ;
2016-12-21 16:16:25 +00:00
_view = me . createView ( 'DocumentHolder' ) . render ( ) ;
2016-11-11 13:24:21 +00:00
$$ ( window ) . on ( 'resize' , _ . bind ( me . onEditorResize , me ) ) ;
} ,
// Handlers
onContextMenuClick : function ( view , eventName ) {
var me = this ;
if ( 'cut' == eventName ) {
2020-02-19 08:15:17 +00:00
var res = me . api . Cut ( ) ;
if ( ! res ) {
_view . hideMenu ( ) ;
uiApp . modal ( {
title : me . textCopyCutPasteActions ,
text : me . errorCopyCutPaste ,
buttons : [ { text : 'OK' } ]
} ) ;
}
2016-11-11 13:24:21 +00:00
} else if ( 'copy' == eventName ) {
2020-02-19 08:15:17 +00:00
var res = me . api . Copy ( ) ;
if ( ! res ) {
_view . hideMenu ( ) ;
uiApp . modal ( {
title : me . textCopyCutPasteActions ,
text : me . errorCopyCutPaste ,
buttons : [ { text : 'OK' } ]
} ) ;
}
2016-11-11 13:24:21 +00:00
} else if ( 'paste' == eventName ) {
2020-02-19 08:15:17 +00:00
var res = me . api . Paste ( ) ;
if ( ! res ) {
_view . hideMenu ( ) ;
uiApp . modal ( {
title : me . textCopyCutPasteActions ,
text : me . errorCopyCutPaste ,
buttons : [ { text : 'OK' } ]
} ) ;
}
2019-04-29 14:01:35 +00:00
} else if ( 'merge' == eventName ) {
me . api . MergeCells ( ) ;
2019-05-06 09:09:27 +00:00
} else if ( 'split' == eventName ) {
_view . hideMenu ( ) ;
me . showSplitModal ( ) ;
2016-11-11 13:24:21 +00:00
} else if ( 'delete' == eventName ) {
2016-11-21 12:29:07 +00:00
me . api . asc _Remove ( ) ;
2019-05-08 07:44:00 +00:00
} else if ( 'deletetable' == eventName ) {
me . api . remTable ( ) ;
2016-11-11 13:24:21 +00:00
} else if ( 'edit' == eventName ) {
2016-12-21 16:16:25 +00:00
_view . hideMenu ( ) ;
2016-11-11 13:24:21 +00:00
DE . getController ( 'EditContainer' ) . showModal ( ) ;
} else if ( 'addlink' == eventName ) {
2016-12-21 16:16:25 +00:00
_view . hideMenu ( ) ;
2016-11-11 13:24:21 +00:00
DE . getController ( 'AddContainer' ) . showModal ( ) ;
2017-01-19 11:12:23 +00:00
DE . getController ( 'AddOther' ) . getView ( 'AddOther' ) . showLink ( false ) ;
2016-11-14 10:35:47 +00:00
} 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 ;
}
} ) ;
2019-02-15 10:35:53 +00:00
} else if ( 'review' == eventName ) {
2019-07-15 13:06:54 +00:00
var getCollaboration = DE . getController ( 'Common.Controllers.Collaboration' ) ;
2019-05-22 07:20:49 +00:00
getCollaboration . showModal ( ) ;
2019-07-15 13:06:54 +00:00
getCollaboration . getView ( 'Common.Views.Collaboration' ) . showPage ( '#reviewing-settings-view' , false ) ;
2019-05-24 08:43:15 +00:00
} else if ( 'reviewchange' == eventName ) {
2019-07-15 13:06:54 +00:00
var getCollaboration = DE . getController ( 'Common.Controllers.Collaboration' ) ;
2019-05-24 08:43:15 +00:00
getCollaboration . showModal ( ) ;
2019-07-15 13:06:54 +00:00
getCollaboration . getView ( 'Common.Views.Collaboration' ) . showPage ( '#reviewing-settings-view' , false ) ;
getCollaboration . getView ( 'Common.Views.Collaboration' ) . showPage ( '#change-view' , false ) ;
2020-03-05 11:20:04 +00:00
} else if ( 'viewcomment' == eventName ) {
var getCollaboration = DE . getController ( 'Common.Controllers.Collaboration' ) ;
getCollaboration . showCommentModal ( ) ;
} else if ( 'addcomment' == eventName ) {
2020-03-30 16:52:13 +00:00
_view . hideMenu ( ) ;
DE . getController ( 'AddContainer' ) . showModal ( ) ;
DE . getController ( 'AddOther' ) . getView ( 'AddOther' ) . showPageComment ( false ) ;
2017-04-11 11:05:56 +00:00
} else if ( 'showActionSheet' == eventName && _actionSheets . length > 0 ) {
_ . delay ( function ( ) {
_ . each ( _actionSheets , function ( action ) {
2019-02-15 10:35:53 +00:00
action . text = action . caption ;
2017-04-11 11:05:56 +00:00
action . onClick = function ( ) {
me . onContextMenuClick ( null , action . event )
}
} ) ;
uiApp . actions ( [ _actionSheets , [
{
text : me . sheetCancel ,
bold : true
}
] ] ) ;
} , 100 ) ;
2016-11-11 13:24:21 +00:00
}
2016-12-21 16:16:25 +00:00
_view . hideMenu ( ) ;
2016-11-11 13:24:21 +00:00
} ,
2019-05-06 09:09:27 +00:00
showSplitModal : function ( ) {
var me = this ,
picker ;
uiApp . modal ( {
title : me . menuSplit ,
text : '' ,
afterText :
'<div class="content-block">' +
'<div class="row no-gutter" style="text-align: center;">' +
'<div class="col-50 size-columns">' + me . textColumns + '</div>' +
'<div class="col-50 size-rows">' + me . textRows + '</div>' +
'</div>' +
'<div id="picker-split-size"></div>' +
'</div>' ,
buttons : [
{
text : me . textCancel
} ,
{
text : 'OK' ,
bold : true ,
onClick : function ( ) {
var size = picker . value ;
if ( me . api ) {
me . api . SplitCell ( parseInt ( size [ 0 ] ) , parseInt ( size [ 1 ] ) ) ;
}
}
}
]
} ) ;
picker = uiApp . picker ( {
container : '#picker-split-size' ,
toolbar : false ,
rotateEffect : true ,
value : [ 3 , 3 ] ,
cols : [ {
textAlign : 'center' ,
width : '100%' ,
values : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
} , {
textAlign : 'center' ,
width : '100%' ,
values : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
} ]
} ) ;
} ,
2016-11-11 13:24:21 +00:00
// API Handlers
onEditorResize : function ( cmp ) {
// Hide context menu
} ,
onApiShowPopMenu : function ( posX , posY ) {
2017-04-11 11:05:56 +00:00
if ( $ ( '.popover.settings, .popup.settings, .picker-modal.settings, .modal.modal-in, .actions-modal' ) . length > 0 ) {
2016-12-21 16:16:25 +00:00
return ;
}
2019-03-14 10:13:13 +00:00
var now = ( new Date ) . getTime ( ) ;
if ( now - _timer < 1000 ) return ;
_timer = 0 ;
2019-02-15 10:35:53 +00:00
_menuPos = [ posX , posY ] ;
2016-12-21 16:16:25 +00:00
2016-11-11 13:24:21 +00:00
var me = this ,
2016-11-14 10:35:47 +00:00
items ;
_stack = me . api . getSelectedElements ( ) ;
items = me . _initMenu ( _stack ) ;
2016-11-11 13:24:21 +00:00
2016-12-21 16:16:25 +00:00
_view . showMenu ( items , posX , posY ) ;
2016-11-11 13:24:21 +00:00
} ,
onApiHidePopMenu : function ( ) {
2019-03-18 06:50:55 +00:00
var now = ( new Date ) . getTime ( ) ;
if ( now - _timer < 1000 ) return ;
2016-12-21 16:16:25 +00:00
_view && _view . hideMenu ( ) ;
2016-11-11 13:24:21 +00:00
} ,
2016-12-28 11:06:13 +00:00
onApiShowForeignCursorLabel : function ( userId , X , Y , color ) {
var me = this ,
tipHeight = 20 ;
var getUserName = function ( id ) {
var usersStore = DE . getCollection ( 'Common.Collections.Users' ) ;
if ( usersStore ) {
var rec = usersStore . findUser ( id ) ;
if ( rec )
return rec . get ( 'username' ) ;
}
return me . textGuest ;
} ;
/** coauthoring begin **/
var src = _ . find ( _fastCoAuthTips , function ( tip ) { return tip . attr ( 'userid' ) == userId ; } ) ;
if ( ! src ) {
src = $ ( document . createElement ( 'div' ) ) ;
src . addClass ( 'username-tip' ) ;
src . attr ( 'userid' , userId ) ;
src . css ( {
height : tipHeight + 'px' ,
position : 'absolute' ,
zIndex : '900' ,
display : 'none' ,
'pointer-events' : 'none' ,
'background-color' : '#' + Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) } ) ;
src . text ( getUserName ( userId ) ) ;
$ ( '#id_main_view' ) . append ( src ) ;
_fastCoAuthTips . push ( src ) ;
src . fadeIn ( 150 ) ;
}
src . css ( {
top : ( Y - tipHeight ) + 'px' ,
left : X + 'px' } ) ;
/** coauthoring end **/
} ,
onApiHideForeignCursorLabel : function ( userId ) {
/** coauthoring begin **/
for ( var i = 0 ; i < _fastCoAuthTips . length ; i ++ ) {
if ( _fastCoAuthTips [ i ] . attr ( 'userid' ) == userId ) {
var src = _fastCoAuthTips [ i ] ;
_fastCoAuthTips [ i ] . fadeOut ( 150 , function ( ) { src . remove ( ) } ) ;
_fastCoAuthTips . splice ( i , 1 ) ;
break ;
}
}
/** coauthoring end **/
} ,
onApiUsersChanged : function ( users ) {
var usersStore = this . getApplication ( ) . getCollection ( 'Common.Collections.Users' ) ;
if ( usersStore ) {
var arrUsers = [ ] , name , user ;
for ( name in users ) {
if ( undefined !== name ) {
user = users [ name ] ;
if ( user ) {
arrUsers . push ( new Common . Models . User ( {
id : user . asc _getId ( ) ,
username : user . asc _getUserName ( ) ,
online : true ,
color : user . asc _getColor ( ) ,
view : user . asc _getView ( )
} ) ) ;
}
}
}
usersStore [ usersStore . size ( ) > 0 ? 'add' : 'reset' ] ( arrUsers ) ;
}
} ,
onApiUserConnection : function ( change ) {
var usersStore = this . getApplication ( ) . getCollection ( 'Common.Collections.Users' ) ;
if ( usersStore ) {
var user = usersStore . findUser ( change . asc _getId ( ) ) ;
if ( ! user ) {
usersStore . add ( new Common . Models . User ( {
id : change . asc _getId ( ) ,
username : change . asc _getUserName ( ) ,
online : change . asc _getState ( ) ,
color : change . asc _getColor ( ) ,
view : change . asc _getView ( )
} ) ) ;
} else {
user . set ( { online : change . asc _getState ( ) } ) ;
}
}
} ,
2017-02-03 08:42:53 +00:00
onApiDocumentContentReady : function ( ) {
_view = this . createView ( 'DocumentHolder' ) . render ( ) ;
} ,
2019-02-15 10:35:53 +00:00
onApiShowChange : function ( sdkchange ) {
_inRevisionChange = sdkchange && sdkchange . length > 0 ;
} ,
2020-03-05 11:20:04 +00:00
onApiShowComment : function ( comments ) {
_isComments = comments && comments . length > 0 ;
} ,
onApiHideComment : function ( ) {
_isComments = false ;
} ,
2016-11-11 13:24:21 +00:00
// Internal
2016-11-14 10:35:47 +00:00
_openLink : function ( url ) {
if ( this . api . asc _getUrlType ( url ) > 0 ) {
var newDocumentPage = window . open ( url , '_blank' ) ;
if ( newDocumentPage ) {
newDocumentPage . focus ( ) ;
}
}
} ,
2016-11-11 13:24:21 +00:00
_initMenu : function ( stack ) {
var me = this ,
2019-07-09 08:49:41 +00:00
arrItems = [ ] ,
arrItemsIcon = [ ] ,
2016-11-11 13:24:21 +00:00
canCopy = me . api . can _CopyCut ( ) ;
2017-04-11 11:05:56 +00:00
_actionSheets = [ ] ;
2016-11-11 13:24:21 +00:00
if ( canCopy ) {
2019-07-09 08:49:41 +00:00
arrItemsIcon . push ( {
2016-11-17 12:24:27 +00:00
caption : me . menuCopy ,
2019-07-09 08:49:41 +00:00
event : 'copy' ,
icon : 'icon-copy'
2016-11-11 13:24:21 +00:00
} ) ;
}
2016-11-14 10:35:47 +00:00
var isText = false ,
isTable = false ,
isImage = false ,
isChart = false ,
isShape = false ,
2019-05-08 11:31:48 +00:00
isLink = false ,
lockedText = false ,
lockedTable = false ,
lockedImage = false ,
lockedHeader = false ;
2016-11-14 10:35:47 +00:00
_ . each ( stack , function ( item ) {
var objectType = item . get _ObjectType ( ) ,
objectValue = item . get _ObjectValue ( ) ;
2019-05-08 11:31:48 +00:00
if ( objectType == Asc . c _oAscTypeSelectElement . Header ) {
lockedHeader = objectValue . get _Locked ( ) ;
}
2016-11-14 10:35:47 +00:00
if ( objectType == Asc . c _oAscTypeSelectElement . Text ) {
isText = true ;
2019-05-08 11:31:48 +00:00
lockedText = objectValue . get _Locked ( ) ;
2016-11-14 10:35:47 +00:00
} else if ( objectType == Asc . c _oAscTypeSelectElement . Image ) {
2019-05-08 11:31:48 +00:00
lockedImage = objectValue . get _Locked ( ) ;
2016-11-14 10:35:47 +00:00
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 ;
2019-05-08 11:31:48 +00:00
lockedTable = objectValue . get _Locked ( ) ;
2016-11-14 10:35:47 +00:00
} else if ( objectType == Asc . c _oAscTypeSelectElement . Hyperlink ) {
isLink = true ;
}
} ) ;
2016-11-11 13:24:21 +00:00
if ( stack . length > 0 ) {
var swapItems = function ( items , indexBefore , indexAfter ) {
items [ indexAfter ] = items . splice ( indexBefore , 1 , items [ indexAfter ] ) [ 0 ] ;
} ;
2019-05-08 11:31:48 +00:00
if ( _isEdit && ! me . isDisconnected ) {
if ( ! lockedText && ! lockedTable && ! lockedImage && ! lockedHeader && canCopy ) {
2019-07-09 08:49:41 +00:00
arrItemsIcon . push ( {
2016-11-23 08:06:35 +00:00
caption : me . menuCut ,
2019-07-09 08:49:41 +00:00
event : 'cut' ,
icon : 'icon-cut'
2016-11-23 08:06:35 +00:00
} ) ;
// Swap 'Copy' and 'Cut'
2019-07-09 08:49:41 +00:00
swapItems ( arrItemsIcon , 0 , 1 ) ;
2016-11-23 08:06:35 +00:00
}
2019-05-08 11:31:48 +00:00
if ( ! lockedText && ! lockedTable && ! lockedImage && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItemsIcon . push ( {
2019-05-08 11:31:48 +00:00
caption : me . menuPaste ,
2019-07-09 08:49:41 +00:00
event : 'paste' ,
icon : 'icon-paste'
2019-05-08 11:31:48 +00:00
} ) ;
}
2016-11-11 13:24:21 +00:00
2019-05-08 11:31:48 +00:00
if ( isTable && me . api . CheckBeforeMergeCells ( ) && ! lockedTable && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-04-29 14:01:35 +00:00
caption : me . menuMerge ,
event : 'merge'
} ) ;
}
2019-05-08 11:31:48 +00:00
if ( isTable && me . api . CheckBeforeSplitCells ( ) && ! lockedTable && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-06 09:09:27 +00:00
caption : me . menuSplit ,
event : 'split'
} ) ;
}
2019-05-08 11:31:48 +00:00
if ( ! lockedText && ! lockedTable && ! lockedImage && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-08 11:31:48 +00:00
caption : me . menuDelete ,
event : 'delete'
} ) ;
}
2016-11-11 13:24:21 +00:00
2019-05-08 11:31:48 +00:00
if ( isTable && ! lockedTable && ! lockedText && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-08 07:44:00 +00:00
caption : me . menuDeleteTable ,
event : 'deletetable'
} ) ;
}
2019-05-08 11:31:48 +00:00
if ( ! lockedText && ! lockedTable && ! lockedImage && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-08 11:31:48 +00:00
caption : me . menuEdit ,
event : 'edit'
} ) ;
}
2016-11-11 13:24:21 +00:00
2019-05-08 11:31:48 +00:00
if ( ! _ . isEmpty ( me . api . can _AddHyperlink ( ) ) && ! lockedHeader ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2016-11-23 08:06:35 +00:00
caption : me . menuAddLink ,
event : 'addlink'
} ) ;
}
2019-02-15 10:35:53 +00:00
2019-05-24 08:43:15 +00:00
if ( _canReview ) {
if ( _inRevisionChange ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-24 08:43:15 +00:00
caption : me . menuReviewChange ,
event : 'reviewchange'
} ) ;
} else {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2019-05-24 08:43:15 +00:00
caption : me . menuReview ,
event : 'review'
} ) ;
}
2019-02-15 10:35:53 +00:00
}
2020-03-05 11:20:04 +00:00
2020-03-15 15:59:42 +00:00
if ( _isComments ) {
2020-03-05 11:20:04 +00:00
arrItems . push ( {
caption : me . menuViewComment ,
event : 'viewcomment'
} ) ;
}
arrItems . push ( {
caption : me . menuAddComment ,
event : 'addcomment'
} ) ;
2016-11-11 13:24:21 +00:00
}
}
2016-11-14 15:38:59 +00:00
if ( isLink ) {
2019-07-09 08:49:41 +00:00
arrItems . push ( {
2016-11-17 12:24:27 +00:00
caption : me . menuOpenLink ,
2016-11-14 15:38:59 +00:00
event : 'openlink'
} ) ;
}
2019-07-09 08:49:41 +00:00
if ( Common . SharedSettings . get ( 'phone' ) && arrItems . length > 2 ) {
_actionSheets = arrItems . slice ( 2 ) ;
2017-04-11 11:05:56 +00:00
2019-07-09 08:49:41 +00:00
arrItems = arrItems . slice ( 0 , 2 ) ;
arrItems . push ( {
2017-04-11 11:05:56 +00:00
caption : me . menuMore ,
event : 'showActionSheet'
} ) ;
}
2019-07-09 08:49:41 +00:00
var menuItems = { itemsIcon : arrItemsIcon , items : arrItems } ;
2016-11-11 13:24:21 +00:00
return menuItems ;
2016-11-17 12:24:27 +00:00
} ,
2017-11-23 09:01:27 +00:00
onCoAuthoringDisconnect : function ( ) {
this . isDisconnected = true ;
} ,
2016-12-28 11:06:13 +00:00
textGuest : 'Guest' ,
2019-05-06 09:09:27 +00:00
textCancel : 'Cancel' ,
textColumns : 'Columns' ,
textRows : 'Rows' ,
2016-11-17 12:24:27 +00:00
menuCut : 'Cut' ,
menuCopy : 'Copy' ,
menuPaste : 'Paste' ,
menuEdit : 'Edit' ,
menuDelete : 'Delete' ,
menuAddLink : 'Add Link' ,
2017-04-11 11:05:56 +00:00
menuOpenLink : 'Open Link' ,
menuMore : 'More' ,
2019-02-15 10:35:53 +00:00
sheetCancel : 'Cancel' ,
menuReview : 'Review' ,
2019-05-06 09:09:27 +00:00
menuMerge : 'Merge Cells' ,
2019-05-08 07:44:00 +00:00
menuSplit : 'Split Cell' ,
2019-05-24 08:43:15 +00:00
menuDeleteTable : 'Delete Table' ,
2020-03-05 11:20:04 +00:00
menuReviewChange : 'Review Change' ,
menuViewComment : 'View Comment' ,
2020-04-06 16:17:02 +00:00
menuAddComment : 'Add Comment' ,
2020-02-19 08:15:17 +00:00
textCopyCutPasteActions : 'Copy, Cut and Paste Actions' ,
errorCopyCutPaste : 'Copy, cut and paste actions using the context menu will be performed within the current file only. You cannot copy or paste to or from other applications.'
2016-11-11 13:24:21 +00:00
}
2016-11-17 12:24:27 +00:00
} ) ( ) , DE . Controllers . DocumentHolder || { } ) )
2016-11-11 13:24:21 +00:00
} ) ;