diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 4ea4bd624..39cbafc03 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -180,7 +180,7 @@ define([ }, lockToolbar: function (causes, lock, opts) { - Common.Utils.lockControls(causes, lock, opts, this.view.getButtons()); + this.view && Common.Utils.lockControls(causes, lock, opts, this.view.getButtons()); }, setPreviewMode: function(mode) { //disable accept/reject in popover diff --git a/apps/documenteditor/main/app/controller/DocProtection.js b/apps/documenteditor/main/app/controller/DocProtection.js index ea7aa1320..4dcc94bb6 100644 --- a/apps/documenteditor/main/app/controller/DocProtection.js +++ b/apps/documenteditor/main/app/controller/DocProtection.js @@ -191,13 +191,12 @@ define([ resolve(); })).then(function () { // me.view.btnProtectDoc.toggle(me.api.asc_isProtectedDocument(), true); - // me.onChangeProtectDocument(); }); }, onChangeProtectDocument: function() { // var isProtected = this.api.asc_isProtectedDocument(); - var isProtected = this.view.btnProtectDoc.isActive(); // test + var isProtected = this.view ? this.view.btnProtectDoc.isActive() : false; // test this.view && this.view.btnProtectDoc.toggle(isProtected, true); this.getDocProps(true); Common.NotificationCenter.trigger('protect:doclock'); @@ -216,7 +215,11 @@ define([ // } // test ////// - var docProtected = this.view.btnProtectDoc.isActive(), + // if (Common.Utils.InternalSettings.get('protect-test-type')===undefined) { + // this.view && this.view.btnProtectDoc.toggle(true, true); + // Common.Utils.InternalSettings.set('protect-test-type', Asc.c_oAscProtection.Comments); + // } + var docProtected = this.view ? this.view.btnProtectDoc.isActive() : true, type; if (docProtected) { diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index b43d56a8c..728813d3d 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -440,7 +440,7 @@ define([ var cntrl = this.getApplication().getController('DocProtection'); docProtection = cntrl ? cntrl.getDocProps() : null; } - if (docProtection) { + if (docProtection && this.view) { var arr = this.view.getButtons(); Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly, {array: arr}); Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly, {array: arr}); diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index f6afb11e2..04febdc0f 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -205,7 +205,7 @@ define([ }, lockToolbar: function (causes, lock, opts) { - Common.Utils.lockControls(causes, lock, opts, this.view.getButtons()); + this.view && Common.Utils.lockControls(causes, lock, opts, this.view.getButtons()); }, onApiCanAddHyperlink: function(value) { @@ -593,8 +593,10 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ - me.view && me.view.onAppReady(config); - me.onChangeProtectDocument(); + if (me.view) { + me.view.onAppReady(config); + me.onChangeProtectDocument(); + } }); } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a0fdd0c70..75c0570a0 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1694,7 +1694,9 @@ define([ var toolbarController = application.getController('Toolbar'); toolbarController && toolbarController.setApi(me.api); - if (this.appOptions.isEdit) { + if (this.appOptions.isRestrictedEdit) + application.getController('DocProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); + else if (this.appOptions.isEdit) { var rightmenuController = application.getController('RightMenu'), fontsControllers = application.getController('Common.Controllers.Fonts'); fontsControllers && fontsControllers.setApi(me.api);