diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c0a598c21..e3de713aa 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -868,18 +868,20 @@ check = function(regex){ return regex.test(userAgent); }, isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)), isChrome = !isIE && check(/\bchrome\b/), - isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0); + isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0), + path_type = "main"; path += app + "/"; - path += (config.type === "mobile" || isSafari_mobile) + path_type = (config.type === "mobile" || isSafari_mobile) ? "mobile" - : (config.type === "embedded" || (app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && - (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) - ? "embed" - : "main"; + : ((app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && + (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) + ? "forms" : (config.type === "embedded") ? "embed" + : "main"; + path += path_type; var index = "/index.html"; - if (config.editorConfig) { + if (config.editorConfig && path_type!=="forms") { var customization = config.editorConfig.customization; if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs || (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) { diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 0c2953ccf..1ae06f6b4 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -1017,7 +1017,7 @@ define([ var wbprotect = this.getApplication().getController('WBProtection'); props = wbprotect ? wbprotect.getWSProps() : null; } - this._state.wsProps = props ? props.wsProps : {}; + this._state.wsProps = props ? props.wsProps : []; this._state.wsLock = props ? props.wsLock : false; if (!this.view) return; diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index da52b2010..c6863d569 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -610,6 +610,8 @@ DE.ApplicationController = new(function(){ if (config.customization.logo.url) { logo.attr('href', config.customization.logo.url); + } else if (config.customization.logo.url!==undefined) { + logo.removeAttr('href');logo.removeAttr('target'); } } var licType = params.asc_getLicenseType(); diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index bbd385060..499254f07 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -438,6 +438,8 @@ define([ if (this.appOptions.customization.logo.url) { logo.attr('href', this.appOptions.customization.logo.url); + } else if (this.appOptions.customization.logo.url!==undefined) { + logo.removeAttr('href');logo.removeAttr('target'); } } diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 1885894af..d03610264 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -322,7 +322,7 @@ define([ this.rightmenu.tableSettings.UpdateThemeColors(); this.rightmenu.shapeSettings.UpdateThemeColors(); this.rightmenu.textartSettings.UpdateThemeColors(); - this.rightmenu.formSettings.UpdateThemeColors(); + this.rightmenu.formSettings && this.rightmenu.formSettings.UpdateThemeColors(); }, updateMetricUnit: function() { diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 8b5f0c351..0cc2bf93e 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -465,6 +465,8 @@ PE.ApplicationController = new(function(){ if (config.customization.logo.url) { logo.attr('href', config.customization.logo.url); + } else if (config.customization.logo.url!==undefined) { + logo.removeAttr('href');logo.removeAttr('target'); } } diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 91b9968b2..29c6e574e 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -363,6 +363,8 @@ SSE.ApplicationController = new(function(){ if (config.customization.logo.url) { logo.attr('href', config.customization.logo.url); + } else if (config.customization.logo.url!==undefined) { + logo.removeAttr('href');logo.removeAttr('target'); } } diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 15a11225c..ff1223e9e 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -116,7 +116,7 @@ define([ me._currentMathObj = undefined; me._currentParaObjDisabled = false; me._isDisabled = false; - me._state = {}; + me._state = {wsLock: false, wsProps: []}; me.fastcoauthtips = []; me._TtHeight = 20; /** coauthoring begin **/ diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index f5f43f48a..9764b6f26 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1389,11 +1389,13 @@ define([ Common.Utils.Metric.setCurrentMetric(value); Common.Utils.InternalSettings.set("sse-settings-unit", value); - if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode + if (this.appOptions.isRestrictedEdit) { + var toolbarController = application.getController('Toolbar'); + toolbarController && toolbarController.setApi(me.api); + application.getController('WBProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); + } else if (this.appOptions.isEdit) { // set api events for toolbar in the Restricted Editing mode var toolbarController = application.getController('Toolbar'); toolbarController && toolbarController.setApi(me.api); - - if (!this.appOptions.isEdit) return; var statusbarController = application.getController('Statusbar'), rightmenuController = application.getController('RightMenu'), diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 00bcf8923..a1cf476a0 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -54,7 +54,7 @@ define([ initialize: function() { this.editMode = true; - this._state = {}; + this._state = {wsLock: false, wsProps: []}; this.addListeners({ 'Toolbar': { @@ -456,8 +456,10 @@ define([ var wbprotect = this.getApplication().getController('WBProtection'); props = wbprotect ? wbprotect.getWSProps() : null; } - this._state.wsProps = props.wsProps; - this._state.wsLock = props.wsLock; + if (props) { + this._state.wsProps = props.wsProps; + this._state.wsLock = props.wsLock; + } this.onSelectionChanged(this.api.asc_getCellInfo()); } }); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e045f7e44..cc434b41b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -426,9 +426,10 @@ define([ this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); - } else if (config.isRestrictedEdit) + } else if (config.isRestrictedEdit) { this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this)); - + Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this)); + } }, // onNewDocument: function(btn, e) { @@ -2913,10 +2914,13 @@ define([ }, onApiSelectionChangedRestricted: function(info) { + if (!this.appConfig.isRestrictedEdit) return; + var selectionType = info.asc_getSelectionType(); this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), { array: this.btnsComment }); + this.toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment }); }, onApiSelectionChanged_DiagramEditor: function(info) { @@ -4065,7 +4069,7 @@ define([ this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock); this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]}); - this.onApiSelectionChanged(this.api.asc_getCellInfo()); + this.appConfig && this.appConfig.isEdit ? this.onApiSelectionChanged(this.api.asc_getCellInfo()) : this.onApiSelectionChangedRestricted(this.api.asc_getCellInfo()); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/WBProtection.js b/apps/spreadsheeteditor/main/app/controller/WBProtection.js index 9590cbc02..a1e17fbb8 100644 --- a/apps/spreadsheeteditor/main/app/controller/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/controller/WBProtection.js @@ -98,15 +98,16 @@ define([ setMode: function(mode) { this.appConfig = mode; - this.view = this.createView('WBProtection', { + this.appConfig.isEdit && (this.view = this.createView('WBProtection', { mode: mode - }); + })); return this; }, createToolbarPanel: function() { - return this.view.getPanel(); + if (this.view) + return this.view.getPanel(); }, getView: function(name) { @@ -270,6 +271,8 @@ define([ }, onAppReady: function (config) { + if (!this.view) return; + var me = this; (new Promise(function (resolve) { resolve(); @@ -284,15 +287,17 @@ define([ }, onChangeProtectWorkbook: function() { - this.view.btnProtectWB.toggle(this.api.asc_isProtectedWorkbook(), true); + this.view && this.view.btnProtectWB.toggle(this.api.asc_isProtectedWorkbook(), true); }, onChangeProtectSheet: function() { var props = this.getWSProps(true); - this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet - Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); - Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]}); + if (this.view) { + this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet + Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); + Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]}); + } Common.NotificationCenter.trigger('protect:wslock', props); }, @@ -301,6 +306,8 @@ define([ }, getWSProps: function(update) { + if (!this.appConfig || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) return; + if (update || !this._state.protection) { var wsProtected = !!this.api.asc_isProtectedSheet(); var arr = []; @@ -322,6 +329,7 @@ define([ }, onApiSelectionChanged: function(info) { + if (!this.view) return; if ($('.asc-window.enable-key-events:visible').length>0) return; var selectionType = info.asc_getSelectionType();