[DE] Fix protection for restricted modes

This commit is contained in:
Julia Radzhabova 2022-09-27 14:32:41 +03:00
parent 00d7a665e6
commit 9adcc64e9b
5 changed files with 16 additions and 9 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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});

View file

@ -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();
}
});
}

View file

@ -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);