From 8a5f5c14bc4646e3e47fbd3e29c1e1c4807778a7 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 9 Oct 2025 00:22:18 +0300 Subject: [PATCH 1/3] fixed double dialog --- apps/pdfeditor/main/app/controller/RedactTab.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/pdfeditor/main/app/controller/RedactTab.js b/apps/pdfeditor/main/app/controller/RedactTab.js index 4f47e37294..e031014e32 100644 --- a/apps/pdfeditor/main/app/controller/RedactTab.js +++ b/apps/pdfeditor/main/app/controller/RedactTab.js @@ -58,6 +58,7 @@ define([ onLaunch: function () { this._state = {}; + this.redactionsWarningVisible = null; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); @@ -190,7 +191,8 @@ define([ Common.UI.TooltipManager.closeTip('mark-for-redaction'); Common.UI.TooltipManager.closeTip('apply-redaction'); const isMarked = this.api.HasRedact(); - if (isMarked) { + if (isMarked && !this.redactionsWarningVisible) { + this.redactionsWarningVisible = true; Common.UI.warning({ width: 500, msg: this.textUnappliedRedactions, @@ -207,16 +209,19 @@ define([ this.api.ApplyRedact(); this.api.SetRedactTool(false); this.view.btnMarkForRedact.toggle(false); + this.redactionsWarningVisible = false; } else if (btn == 'doNotApply') { this.api.RemoveAllRedact(); this.api.SetRedactTool(false); this.view.btnMarkForRedact.toggle(false); + this.redactionsWarningVisible = false; } else if (btn == 'cancel') { if (this.mode.isPDFEdit) { this.toolbar.toolbar.setTab('red') } else { Common.NotificationCenter.trigger('pdf:mode-apply', 'edit', 'red'); } + this.redactionsWarningVisible = false; } }, this) }); From 2372d1dbe41e03efd23fd0d60a4ff20ffac35f58 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 9 Oct 2025 12:24:52 +0300 Subject: [PATCH 2/3] fixed menu file hiding --- apps/pdfeditor/main/app/controller/LeftMenu.js | 3 ++- apps/pdfeditor/main/app/controller/RedactTab.js | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/LeftMenu.js b/apps/pdfeditor/main/app/controller/LeftMenu.js index 0f6701c9e3..94648dd832 100644 --- a/apps/pdfeditor/main/app/controller/LeftMenu.js +++ b/apps/pdfeditor/main/app/controller/LeftMenu.js @@ -113,7 +113,8 @@ define([ 'search:showredact': _.bind(this.onShowHideRedactSearch, this) }, 'RedactTab': { - 'search:showredact': _.bind(this.onShowHideRedactSearch, this) + 'search:showredact': _.bind(this.onShowHideRedactSearch, this), + 'menu:hide': _.bind(this.clickToolbarTab, this, 'red') }, 'Common.Views.SearchPanel': { 'search:showredact': _.bind(this.onShowHideRedactSearch, this) diff --git a/apps/pdfeditor/main/app/controller/RedactTab.js b/apps/pdfeditor/main/app/controller/RedactTab.js index e031014e32..f50345bc2b 100644 --- a/apps/pdfeditor/main/app/controller/RedactTab.js +++ b/apps/pdfeditor/main/app/controller/RedactTab.js @@ -59,6 +59,7 @@ define([ this._state = {}; this.redactionsWarningVisible = null; + this.isFileMenuTab = null; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); @@ -191,9 +192,11 @@ define([ Common.UI.TooltipManager.closeTip('mark-for-redaction'); Common.UI.TooltipManager.closeTip('apply-redaction'); const isMarked = this.api.HasRedact(); - if (isMarked && !this.redactionsWarningVisible) { - this.redactionsWarningVisible = true; - Common.UI.warning({ + if ( + isMarked && + (!this.redactionsWarningVisible || !this.redactionsWarningVisible.isVisible()) + ) { + this.redactionsWarningVisible = Common.UI.warning({ width: 500, msg: this.textUnappliedRedactions, buttons: [{ @@ -209,19 +212,19 @@ define([ this.api.ApplyRedact(); this.api.SetRedactTool(false); this.view.btnMarkForRedact.toggle(false); - this.redactionsWarningVisible = false; } else if (btn == 'doNotApply') { this.api.RemoveAllRedact(); this.api.SetRedactTool(false); this.view.btnMarkForRedact.toggle(false); - this.redactionsWarningVisible = false; } else if (btn == 'cancel') { + if (this.isFileMenuTab) { + this.view.fireEvent('menu:hide', [this]); + } if (this.mode.isPDFEdit) { this.toolbar.toolbar.setTab('red') } else { Common.NotificationCenter.trigger('pdf:mode-apply', 'edit', 'red'); } - this.redactionsWarningVisible = false; } }, this) }); @@ -230,6 +233,7 @@ define([ this.api.SetRedactTool(false); } } + this.isFileMenuTab = tab === 'file' ? true : false; }, onRedactionStateToggle: function(isRedaction) { From 16885f4fcb8fdbe43407756c026d996f188974e1 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 9 Oct 2025 14:17:49 +0300 Subject: [PATCH 3/3] Refactoring --- apps/pdfeditor/main/app/controller/RedactTab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/RedactTab.js b/apps/pdfeditor/main/app/controller/RedactTab.js index f50345bc2b..9bf61db54f 100644 --- a/apps/pdfeditor/main/app/controller/RedactTab.js +++ b/apps/pdfeditor/main/app/controller/RedactTab.js @@ -58,7 +58,7 @@ define([ onLaunch: function () { this._state = {}; - this.redactionsWarningVisible = null; + this.redactionsWarning = null; this.isFileMenuTab = null; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); @@ -194,9 +194,9 @@ define([ const isMarked = this.api.HasRedact(); if ( isMarked && - (!this.redactionsWarningVisible || !this.redactionsWarningVisible.isVisible()) + (!this.redactionsWarning || !this.redactionsWarning.isVisible()) ) { - this.redactionsWarningVisible = Common.UI.warning({ + this.redactionsWarning = Common.UI.warning({ width: 500, msg: this.textUnappliedRedactions, buttons: [{ @@ -216,7 +216,7 @@ define([ this.api.RemoveAllRedact(); this.api.SetRedactTool(false); this.view.btnMarkForRedact.toggle(false); - } else if (btn == 'cancel') { + } else { if (this.isFileMenuTab) { this.view.fireEvent('menu:hide', [this]); } @@ -233,7 +233,7 @@ define([ this.api.SetRedactTool(false); } } - this.isFileMenuTab = tab === 'file' ? true : false; + this.isFileMenuTab = tab === 'file'; }, onRedactionStateToggle: function(isRedaction) {