From 022c65cf3d3793f9f93d45ebed7fde16b9ee244c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 7 Oct 2022 16:21:31 +0300 Subject: [PATCH] [DE] Fix protection --- .../main/app/controller/DocProtection.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/controller/DocProtection.js b/apps/documenteditor/main/app/controller/DocProtection.js index 8ed77b293..2ebff6d29 100644 --- a/apps/documenteditor/main/app/controller/DocProtection.js +++ b/apps/documenteditor/main/app/controller/DocProtection.js @@ -123,7 +123,7 @@ define([ handler: function(result, value, props) { btn = result; if (result == 'ok') { - var protection = new AscCommonWord.CDocProtect(); + var protection = me.api.asc_getDocumentProtection() || new AscCommonWord.CDocProtect(); protection.asc_setEditType(props); protection.asc_setPassword(value); me.api.asc_setDocumentProtection(protection); @@ -151,10 +151,9 @@ define([ btn = result; if (result == 'ok') { if (me.api) { - var protection = new AscCommonWord.CDocProtect(); - protection.asc_setEditType(Asc.c_oAscEDocProtect.None); - value && value.drmOptions && protection.asc_setPassword(value.drmOptions.asc_getPassword()); - me.api.asc_setDocumentProtection(protection); + props.asc_setEditType(Asc.c_oAscEDocProtect.None); + value && value.drmOptions && props.asc_setPassword(value.drmOptions.asc_getPassword()); + me.api.asc_setDocumentProtection(props); } Common.NotificationCenter.trigger('edit:complete'); } @@ -166,9 +165,10 @@ define([ win.show(); } else { - var protection = new AscCommonWord.CDocProtect(); - protection.asc_setEditType(Asc.c_oAscEDocProtect.None); - me.api.asc_setDocumentProtection(protection); + if (!props) + props = new AscCommonWord.CDocProtect(); + props.asc_setEditType(Asc.c_oAscEDocProtect.None); + me.api.asc_setDocumentProtection(props); } } },