diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index d929f68ab..1a647c76b 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -744,14 +744,15 @@ define([ if (this.mode && !this.mode.canComments) hint = true; - if (this.getPopover()) { + var popover = this.getPopover(); + if (popover) { this.clearDummyComment(); if (this.isSelectedComment && (0 === _.difference(this.uids, uids).length)) { //NOTE: click to sdk view ? if (this.api) { //this.view.txtComment.blur(); - this.getPopover().commentsView.setFocusToTextBox(true); + popover.commentsView && popover.commentsView.setFocusToTextBox(true); this.api.asc_enableKeyEvents(true); } @@ -807,12 +808,12 @@ define([ this._dontScrollToComment = false; } - if (this.getPopover().isVisible()) { - this.getPopover().hide(); + if (popover.isVisible()) { + popover.hide(); } - this.getPopover().setLeftTop(posX, posY, leftX); - this.getPopover().show(animate, false, true, text); + popover.setLeftTop(posX, posY, leftX); + popover.show(animate, false, true, text); } }, onApiHideComment: function (hint) { diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 4c66f570d..a425b894c 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -158,7 +158,7 @@ define([ createDelayedElements: function() { /** coauthoring begin **/ if ( this.mode.canCoAuthoring ) { - this.leftMenu.btnComments[(this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); + this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); @@ -596,7 +596,7 @@ define([ } return false; case 'comments': - if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) { + if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion) { Common.UI.Menu.Manager.hideAll(); this.leftMenu.showMenu('comments'); this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 5b95fbcaa..7a920250a 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -981,8 +981,9 @@ define([ this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory; this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && /*!this.appOptions.isDesktopApp*/ !this.appOptions.isOffline; this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring; - this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); - this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? this.appOptions.isEdit : this.permissions.comments); + this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); + this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; @@ -1012,7 +1013,7 @@ define([ this.applyModeCommonElements(); this.applyModeEditorElements(); - this.api.asc_setViewMode(!this.appOptions.isEdit); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments); this.api.asc_LoadDocument(); if (!this.appOptions.isEdit) { @@ -1065,6 +1066,12 @@ define([ }, applyModeEditorElements: function() { + if (this.appOptions.canComments || this.appOptions.isEdit) { + /** coauthoring begin **/ + this.contComments.setMode(this.appOptions); + this.contComments.setConfig({config: this.editorConfig}, this.api); + /** coauthoring end **/ + } if (this.appOptions.isEdit) { var me = this, application = this.getApplication(), @@ -1076,10 +1083,6 @@ define([ fontsControllers && fontsControllers.setApi(me.api); toolbarController && toolbarController.setApi(me.api); - /** coauthoring begin **/ - me.contComments.setMode(me.appOptions); - me.contComments.setConfig({config: me.editorConfig}, me.api); - /** coauthoring end **/ rightmenuController && rightmenuController.setApi(me.api); if (reviewController) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 8f265e9c5..e154d086c 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1540,7 +1540,7 @@ define([ this.mode = m; /** coauthoring begin **/ - !(this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) + !(this.mode.canCoAuthoring && this.mode.canComments) ? Common.util.Shortcuts.suspendEvents(hkComments) : Common.util.Shortcuts.resumeEvents(hkComments); /** coauthoring end **/ @@ -1725,7 +1725,7 @@ define([ /** coauthoring begin **/ addComment: function(item, e, eOpt){ - if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { + if (this.api && this.mode.canCoAuthoring && this.mode.canComments) { this.suppressEditComplete = true; var controller = DE.getController('Common.Controllers.Comments'); @@ -1819,9 +1819,10 @@ define([ initMenu: function (value) { var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties())); - menuViewUndo.setVisible(me.mode.isEdit); - menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); - menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); + menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments); + menuViewUndo.setDisabled(/* !me.api.asc_canUndo()*/); + menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments); + menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments); menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true); var cancopy = me.api && me.api.can_CopyCut(); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index be14a186f..d4ae3c05c 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -111,14 +111,14 @@ define([ template: _.template([ '
| ', ' | ', - ' | |||||||||
| ', ' | ', - ' | |||||||||
| ', @@ -337,6 +337,7 @@ define([ /** coauthoring begin **/ $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); + $('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide'](); /** coauthoring end **/ }, diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 2da063bda..d749de2dc 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -155,7 +155,7 @@ define([ createDelayedElements: function() { /** coauthoring begin **/ if ( this.mode.canCoAuthoring ) { - this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); + this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); @@ -494,7 +494,7 @@ define([ } return false; case 'comments': - if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion && (!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) { + if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion && (!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) { Common.UI.Menu.Manager.hideAll(); this.leftMenu.showMenu('comments'); this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 1e97025ea..dcc32cb40 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -751,8 +751,9 @@ define([ this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false; this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable(); - this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); - this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? this.appOptions.isEdit : this.permissions.comments); + this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); + this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); @@ -776,7 +777,7 @@ define([ this.applyModeCommonElements(); this.applyModeEditorElements(); - this.api.asc_setViewMode(!this.appOptions.isEdit); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments); this.api.asc_LoadDocument(); @@ -826,6 +827,15 @@ define([ }, applyModeEditorElements: function(prevmode) { + if (this.appOptions.canComments || this.appOptions.isEdit) { + /** coauthoring begin **/ + var commentsController = this.getApplication().getController('Common.Controllers.Comments'); + if (commentsController) { + commentsController.setMode(this.appOptions); + commentsController.setConfig({config: this.editorConfig}, this.api); + } + /** coauthoring end **/ + } if (this.appOptions.isEdit) { var me = this, application = this.getApplication(), @@ -837,13 +847,6 @@ define([ fontsControllers && fontsControllers.setApi(me.api); toolbarController && toolbarController.setApi(me.api); - /** coauthoring begin **/ - var commentsController = application.getController('Common.Controllers.Comments'); - if (commentsController) { - commentsController.setMode(this.appOptions); - commentsController.setConfig({config: me.editorConfig}, me.api); - } - /** coauthoring end **/ rightmenuController && rightmenuController.setApi(me.api); var viewport = this.getApplication().getController('Viewport').getView('Viewport'); diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 8704cd7d8..f50e98f59 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1527,7 +1527,7 @@ define([ me.mode = mode; /** coauthoring begin **/ - !(me.mode.canCoAuthoring && me.mode.isEdit && me.mode.canComments) + !(me.mode.canCoAuthoring && me.mode.canComments) ? Common.util.Shortcuts.suspendEvents(hkComments) : Common.util.Shortcuts.resumeEvents(hkComments); /** coauthoring end **/ @@ -1609,7 +1609,7 @@ define([ /** coauthoring begin **/ addComment: function(item, e, eOpt){ - if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { + if (this.api && this.mode.canCoAuthoring && this.mode.canComments) { this.suppressEditComplete = true; var controller = PE.getController('Common.Controllers.Comments'); @@ -1715,9 +1715,10 @@ define([ this.viewModeMenu = new Common.UI.Menu({ initMenu: function (value) { - menuViewUndo.setVisible(me.mode.isEdit); - menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); - menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && me.mode.isEdit); + menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments); + menuViewUndo.setDisabled(/* !me.api.asc_canUndo()*/); + menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments); + menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments); menuViewAddComment.setDisabled(value.locked); }, items: [ diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 50945b669..becc18940 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -240,7 +240,7 @@ define([ setMode: function(permissions) { this.permissions = permissions; /** coauthoring begin **/ - !(this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) + !(this.permissions.canCoAuthoring && this.permissions.canComments) ? Common.util.Shortcuts.suspendEvents(this.hkComments) : Common.util.Shortcuts.resumeEvents(this.hkComments); /** coauthoring end **/ @@ -255,17 +255,18 @@ define([ // this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment); /** coauthoring end **/ this.api.asc_registerCallback('asc_onHyperlinkClick', _.bind(this.onApiHyperlinkClick, this)); - this.api.asc_registerCallback('asc_onSetAFDialog', _.bind(this.onApiAutofilter, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); - this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); - this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); - this.api.asc_registerCallback('asc_onEntriesListMenu', _.bind(this.onEntriesListMenu, this)); // Alt + Down - this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this)); - this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this)); - this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this)); - + this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); + if (this.permissions.isEdit===true) { + this.api.asc_registerCallback('asc_onSetAFDialog', _.bind(this.onApiAutofilter, this)); + this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); + this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); + this.api.asc_registerCallback('asc_onEntriesListMenu', _.bind(this.onEntriesListMenu, this)); // Alt + Down + this.api.asc_registerCallback('asc_onFormulaCompleteMenu', _.bind(this.onFormulaCompleteMenu, this)); + this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(this.onShowSpecialPasteOptions, this)); + this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(this.onHideSpecialPasteOptions, this)); + } return this; }, @@ -561,7 +562,7 @@ define([ }, onAddComment: function(item) { - if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) { + if (this.api && this.permissions.canCoAuthoring && this.permissions.canComments) { var controller = SSE.getController('Common.Controllers.Comments'), cellinfo = this.api.asc_getCellInfo(); @@ -953,7 +954,7 @@ define([ } } - if (me.permissions.isEdit) { + if (me.permissions.isEdit || me.permissions.canComments) { if (index_comments && !this.popupmenu) { data = dataarray[index_comments - 1]; if (!commentTip.editCommentId && commentTip.moveCommentId != data.asc_getCommentIndexes()[0]) { @@ -995,7 +996,9 @@ define([ } } } + } + if (me.permissions.isEdit) { if (index_locked) { data = dataarray[index_locked-1]; @@ -1485,9 +1488,10 @@ define([ if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return; - documentHolder.menuViewUndo.setVisible(this.permissions.isEdit); - documentHolder.menuViewCopySeparator.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && this.permissions.isEdit); - documentHolder.menuViewAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && this.permissions.isEdit); + documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments); + documentHolder.menuViewUndo.setDisabled(!this.api.asc_getCanUndo()); + documentHolder.menuViewCopySeparator.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments); + documentHolder.menuViewAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments); documentHolder.setMenuItemCommentCaptionMode(documentHolder.menuViewAddComment, cellinfo.asc_getComments().length < 1, this.permissions.canEditComments); commentsController && commentsController.blockPopover(true); documentHolder.menuViewAddComment.setDisabled(isCellLocked || isTableLocked); diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index a575d2967..1fc36d2ea 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -163,7 +163,7 @@ define([ createDelayedElements: function() { /** coauthoring begin **/ if ( this.mode.canCoAuthoring ) { - this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); + this.leftMenu.btnComments[(this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); @@ -661,7 +661,7 @@ define([ } return false; case 'comments': - if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) { + if (this.mode.canCoAuthoring && this.mode.canComments && !this.mode.isLightVersion) { Common.UI.Menu.Manager.hideAll(); this.leftMenu.showMenu('comments'); this.getApplication().getController('Common.Controllers.Comments').onAfterShow(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 8e6bfc195..bca1103b9 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -422,7 +422,7 @@ define([ action && this.setLongActionView(action); if (id == Asc.c_oAscAsyncAction.Save) { - this.toolbarView.synchronizeChanges(); + this.toolbarView && this.toolbarView.synchronizeChanges(); } action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction}); @@ -765,8 +765,9 @@ define([ /** coauthoring begin **/ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; /** coauthoring end **/ - this.appOptions.canComments = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); - this.appOptions.canChat = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit) && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); + this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comments===undefined ? (this.permissions.edit !== false && this.editorConfig.mode !== 'view') : this.permissions.comments); + this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); + this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canRename = !!this.permissions.rename; this.appOptions.isTrial = params.asc_getTrial(); @@ -797,7 +798,7 @@ define([ this.applyModeCommonElements(); this.applyModeEditorElements(); - this.api.asc_setViewMode(!this.appOptions.isEdit); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments); (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? this.api.asc_LoadEmptyDocument() : this.api.asc_LoadDocument(); if (!this.appOptions.isEdit) { @@ -871,46 +872,38 @@ define([ }, applyModeEditorElements: function(prevmode) { + if (this.appOptions.canComments || this.appOptions.isEdit) { + /** coauthoring begin **/ + var commentsController = this.getApplication().getController('Common.Controllers.Comments'); + if (commentsController) { + commentsController.setMode(this.appOptions); + commentsController.setConfig({ + config : this.editorConfig, + sdkviewname : '#ws-canvas-outer', + hintmode : true}, + this.api); + } + /** coauthoring end **/ + } + if (this.appOptions.isEdit) { var me = this, application = this.getApplication(), toolbarController = application.getController('Toolbar'), statusbarController = application.getController('Statusbar'), rightmenuController = application.getController('RightMenu'), - /** coauthoring begin **/ - commentsController = application.getController('Common.Controllers.Comments'), - /** coauthoring end **/ - fontsControllers = application.getController('Common.Controllers.Fonts'); + fontsControllers = application.getController('Common.Controllers.Fonts'); fontsControllers && fontsControllers.setApi(me.api); toolbarController && toolbarController.setApi(me.api); // statusbarController && statusbarController.setApi(me.api); - if (commentsController) { - commentsController.setMode(this.appOptions); - commentsController.setConfig({ - config : me.editorConfig, - sdkviewname : '#ws-canvas-outer', - hintmode : true}, - me.api); - } - rightmenuController && rightmenuController.setApi(me.api); if (statusbarController) { statusbarController.getView('Statusbar').changeViewMode(true); } - /** coauthoring begin **/ - if (prevmode=='view') { - if (commentsController) { - Common.NotificationCenter.trigger('comments:updatefilter',{ - property : 'uid', - value : new RegExp('^(doc_|sheet' + this.api.asc_getActiveWorksheetId() + '_)')}); - } - } - /** coauthoring end **/ - var viewport = this.getApplication().getController('Viewport').getView('Viewport'); viewport.applyEditorMode(); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 389a39ded..cc2c7fdf7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2711,9 +2711,11 @@ define([ }, applyFormulaSettings: function() { - var formulas = this.toolbar.btnInsertFormula.menu.items; - for (var i=0; i |
| ', ' | ', - ' |
| ', ' | ', - ' |
| ', ' | ', @@ -480,12 +480,12 @@ define([ ' |
| ', ' | ',
' ',
' | ',
- '
| ', ' | ', @@ -668,13 +668,14 @@ define([ setMode: function(mode) { this.mode = mode; + $('tr.edit', this.el)[mode.isEdit ? 'show' : 'hide'](); $('tr.autosave', this.el)[mode.isEdit ? 'show' : 'hide'](); if (this.mode.isDesktopApp && this.mode.isOffline) { this.chAutosave.setCaption(this.strAutoRecover); this.lblAutosave.text(this.textAutoRecover); } $('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide'](); - $('tr.coauth', this.el)[mode.canCoAuthoring && mode.isEdit ? 'show' : 'hide'](); + $('tr.comments', this.el)[mode.canCoAuthoring && mode.canComments ? 'show' : 'hide'](); $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide'](); }, |