[DE] Fix protection

This commit is contained in:
Julia Radzhabova 2022-10-07 16:21:31 +03:00
parent 528f48d098
commit 022c65cf3d

View file

@ -123,7 +123,7 @@ define([
handler: function(result, value, props) { handler: function(result, value, props) {
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
var protection = new AscCommonWord.CDocProtect(); var protection = me.api.asc_getDocumentProtection() || new AscCommonWord.CDocProtect();
protection.asc_setEditType(props); protection.asc_setEditType(props);
protection.asc_setPassword(value); protection.asc_setPassword(value);
me.api.asc_setDocumentProtection(protection); me.api.asc_setDocumentProtection(protection);
@ -151,10 +151,9 @@ define([
btn = result; btn = result;
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
var protection = new AscCommonWord.CDocProtect(); props.asc_setEditType(Asc.c_oAscEDocProtect.None);
protection.asc_setEditType(Asc.c_oAscEDocProtect.None); value && value.drmOptions && props.asc_setPassword(value.drmOptions.asc_getPassword());
value && value.drmOptions && protection.asc_setPassword(value.drmOptions.asc_getPassword()); me.api.asc_setDocumentProtection(props);
me.api.asc_setDocumentProtection(protection);
} }
Common.NotificationCenter.trigger('edit:complete'); Common.NotificationCenter.trigger('edit:complete');
} }
@ -166,9 +165,10 @@ define([
win.show(); win.show();
} else { } else {
var protection = new AscCommonWord.CDocProtect(); if (!props)
protection.asc_setEditType(Asc.c_oAscEDocProtect.None); props = new AscCommonWord.CDocProtect();
me.api.asc_setDocumentProtection(protection); props.asc_setEditType(Asc.c_oAscEDocProtect.None);
me.api.asc_setDocumentProtection(props);
} }
} }
}, },