fixed menu file hiding

This commit is contained in:
nikita_bartoshuk
2025-10-09 12:24:52 +03:00
parent 8a5f5c14bc
commit 2372d1dbe4
2 changed files with 12 additions and 7 deletions

View File

@ -113,7 +113,8 @@ define([
'search:showredact': _.bind(this.onShowHideRedactSearch, this) 'search:showredact': _.bind(this.onShowHideRedactSearch, this)
}, },
'RedactTab': { 'RedactTab': {
'search:showredact': _.bind(this.onShowHideRedactSearch, this) 'search:showredact': _.bind(this.onShowHideRedactSearch, this),
'menu:hide': _.bind(this.clickToolbarTab, this, 'red')
}, },
'Common.Views.SearchPanel': { 'Common.Views.SearchPanel': {
'search:showredact': _.bind(this.onShowHideRedactSearch, this) 'search:showredact': _.bind(this.onShowHideRedactSearch, this)

View File

@ -59,6 +59,7 @@ define([
this._state = {}; this._state = {};
this.redactionsWarningVisible = null; this.redactionsWarningVisible = null;
this.isFileMenuTab = null;
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, 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('mark-for-redaction');
Common.UI.TooltipManager.closeTip('apply-redaction'); Common.UI.TooltipManager.closeTip('apply-redaction');
const isMarked = this.api.HasRedact(); const isMarked = this.api.HasRedact();
if (isMarked && !this.redactionsWarningVisible) { if (
this.redactionsWarningVisible = true; isMarked &&
Common.UI.warning({ (!this.redactionsWarningVisible || !this.redactionsWarningVisible.isVisible())
) {
this.redactionsWarningVisible = Common.UI.warning({
width: 500, width: 500,
msg: this.textUnappliedRedactions, msg: this.textUnappliedRedactions,
buttons: [{ buttons: [{
@ -209,19 +212,19 @@ define([
this.api.ApplyRedact(); this.api.ApplyRedact();
this.api.SetRedactTool(false); this.api.SetRedactTool(false);
this.view.btnMarkForRedact.toggle(false); this.view.btnMarkForRedact.toggle(false);
this.redactionsWarningVisible = false;
} else if (btn == 'doNotApply') { } else if (btn == 'doNotApply') {
this.api.RemoveAllRedact(); this.api.RemoveAllRedact();
this.api.SetRedactTool(false); this.api.SetRedactTool(false);
this.view.btnMarkForRedact.toggle(false); this.view.btnMarkForRedact.toggle(false);
this.redactionsWarningVisible = false;
} else if (btn == 'cancel') { } else if (btn == 'cancel') {
if (this.isFileMenuTab) {
this.view.fireEvent('menu:hide', [this]);
}
if (this.mode.isPDFEdit) { if (this.mode.isPDFEdit) {
this.toolbar.toolbar.setTab('red') this.toolbar.toolbar.setTab('red')
} else { } else {
Common.NotificationCenter.trigger('pdf:mode-apply', 'edit', 'red'); Common.NotificationCenter.trigger('pdf:mode-apply', 'edit', 'red');
} }
this.redactionsWarningVisible = false;
} }
}, this) }, this)
}); });
@ -230,6 +233,7 @@ define([
this.api.SetRedactTool(false); this.api.SetRedactTool(false);
} }
} }
this.isFileMenuTab = tab === 'file' ? true : false;
}, },
onRedactionStateToggle: function(isRedaction) { onRedactionStateToggle: function(isRedaction) {