From 47eff2849a2530aa9ff68cf3d78cf34845519ecb Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Thu, 20 Nov 2025 03:42:02 +0300 Subject: [PATCH] Fix bug 77529 --- apps/common/main/lib/view/SearchBar.js | 5 +++-- apps/pdfeditor/main/app/controller/RedactTab.js | 17 +++++++++++++++++ apps/pdfeditor/main/app/controller/Viewport.js | 6 ++++-- apps/pdfeditor/main/app/view/RedactTab.js | 7 ++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js index f40041b716..dbab45037a 100644 --- a/apps/common/main/lib/view/SearchBar.js +++ b/apps/common/main/lib/view/SearchBar.js @@ -76,6 +76,7 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.iconType = this.options.iconType; + this.mode = options.editMode; Common.UI.Window.prototype.initialize.call(this, this.options); Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); @@ -169,8 +170,8 @@ define([ this.updateResultsNumber(resultNumber, allResults); }, this)); - this.btnOpenPanelRedact && this.btnOpenPanelRedact.setVisible(this.mode === 'edit') - + this.btnOpenPanelRedact && this.btnOpenPanelRedact.setVisible(this.mode === true); + this.btnOpenPanel && this.btnOpenPanel.setVisible(this.mode === false); return this; }, diff --git a/apps/pdfeditor/main/app/controller/RedactTab.js b/apps/pdfeditor/main/app/controller/RedactTab.js index 8703db5528..905090f406 100644 --- a/apps/pdfeditor/main/app/controller/RedactTab.js +++ b/apps/pdfeditor/main/app/controller/RedactTab.js @@ -53,6 +53,14 @@ define([ sdkViewName : '#id_main', initialize: function () { + this.addListeners({ + 'Common.Views.SearchPanel': { + 'search:showredact': _.bind(this.onToggleFindRedact, this, 'show') + }, + 'SearchBar': { + 'search:showredact': _.bind(this.onToggleFindRedact, this, 'show') + } + }); }, onLaunch: function () { @@ -62,12 +70,21 @@ define([ this.isFileMenuTab = null; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); + Common.NotificationCenter.on('leftmenu:change', _.bind(this.onToggleFindRedact, this)); this.binding = { }; }, + onToggleFindRedact: function (action) { + if (action === 'hide') { + this.view.btnFindRedact.toggle(false); + } else { + this.view.btnFindRedact.toggle(true); + } + }, + setApi: function (api) { if (api) { this.api = api; diff --git a/apps/pdfeditor/main/app/controller/Viewport.js b/apps/pdfeditor/main/app/controller/Viewport.js index dbd5377732..ec0f0f3aa9 100644 --- a/apps/pdfeditor/main/app/controller/Viewport.js +++ b/apps/pdfeditor/main/app/controller/Viewport.js @@ -298,8 +298,10 @@ define([ (!Common.UI.LayoutManager.isElementVisible('leftMenu') || this.mode.customization && this.mode.customization.leftMenu === false); this.searchBar = new Common.UI.SearchBar( hideLeftPanel ? { showOpenPanel: false, - width: 303 - } : {}); + width: 303, + } : { + editMode: this.mode.isPDFEdit + }); this.searchBar.on('hide', _.bind(function () { this.header.btnSearch.toggle(false, true); Common.NotificationCenter.trigger('edit:complete'); diff --git a/apps/pdfeditor/main/app/view/RedactTab.js b/apps/pdfeditor/main/app/view/RedactTab.js index f8527523a6..294e9eda93 100644 --- a/apps/pdfeditor/main/app/view/RedactTab.js +++ b/apps/pdfeditor/main/app/view/RedactTab.js @@ -110,6 +110,7 @@ define([ iconCls: 'toolbar__icon btn-find-to-redact', lock: [_set.lostConnect, _set.disableOnStart], caption: me.capFindRedact, + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small', @@ -197,7 +198,11 @@ define([ }, onOpenPanel: function () { - this.fireEvent('search:showredact', [true, '']); + if (this.btnFindRedact.pressed === false) { + Common.NotificationCenter.trigger('leftmenu:change', 'hide'); + } else { + this.fireEvent('search:showredact', [true, '']); + } }, } }()), PDFE.Views.RedactTab || {}));