From 4d235ad893d20615a4264fe87785a4f4e1cd5ec7 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Fri, 21 Nov 2025 15:38:35 +0300 Subject: [PATCH] [DE] For bug 78627: show warning if copying is disabled --- .../main/app/controller/DocumentHolderExt.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 9 +++++++++ apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/documenteditor/main/locale/en.json | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/DocumentHolderExt.js b/apps/documenteditor/main/app/controller/DocumentHolderExt.js index 4eb2d18f9e..703dc2a0df 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/documenteditor/main/app/controller/DocumentHolderExt.js @@ -2140,7 +2140,7 @@ define([], function () { if (me.api) { var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("de-hide-copywarning")) { + if (!Common.localStorage.getBool("de-hide-copywarning") && (item.value === 'paste' || me.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index f03591e5e1..012c902892 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1303,6 +1303,9 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); + if (!this.appOptions.canCopy) + Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); + Common.Utils.InternalSettings.set("de-settings-datetime-default", Common.localStorage.getItem("de-settings-datetime-default")); /** coauthoring begin **/ @@ -1750,6 +1753,7 @@ define([ this.appOptions.canDownload = this.permissions.download !== false; this.appOptions.showSaveButton = this.appOptions.isEdit || !this.appOptions.isRestrictedEdit && this.appOptions.isPDFForm && this.appOptions.canDownload; // save to file or save to file copy (for pdf-form viewer) this.appOptions.canSuggest = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.suggestFeature===false); + this.appOptions.canCopy = this.permissions.copy !== false; if (this.appOptions.isPDFForm && !this.appOptions.isEdit && !this.appOptions.isRestrictedEdit) { if (!this.appOptions.isRestrictedEdit && !this.appOptions.canEdit) @@ -2360,6 +2364,11 @@ define([ config.msg = this.errorInconsistentExt; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index b5d8da7ea0..88a630c415 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -1268,7 +1268,7 @@ define([ if (me.api) { var res = (type === 'cut') ? me.api.Cut() : ((type === 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("de-hide-copywarning")) { + if (!Common.localStorage.getBool("de-hide-copywarning") && (type === 'paste' || me.toolbar.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 43f1ff0a51..605c465a2b 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1716,6 +1716,7 @@ "DE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "DE.Controllers.Main.warnStartFilling": "Form filling is in progress.
File editing is not currently available.", + "DE.Controllers.Main.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "DE.Controllers.Navigation.txtBeginning": "Beginning of document", "DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "DE.Controllers.Print.textMarginsLast": "Last Custom",