From ffb4461526674aed5914634dc99a6a427ebb24c4 Mon Sep 17 00:00:00 2001 From: Jason Ojisan Date: Sat, 6 Jul 2024 02:32:13 +0300 Subject: [PATCH] react to config change --- ext/js/display/display.js | 2 +- ext/js/display/search-display-controller.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ext/js/display/display.js b/ext/js/display/display.js index 3b259b0001..d58db7277d 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -430,7 +430,7 @@ export class Display extends EventDispatcher { * @throws {Error} * @returns {boolean} */ - searchStickyHeader() { + isSearchStickyHeaderEnabled() { if (this._options) { return Boolean(this._options.popupWindow.searchStickyHeader); } else { diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js index 572ae9910a..83b74fc133 100644 --- a/ext/js/display/search-display-controller.js +++ b/ext/js/display/search-display-controller.js @@ -115,10 +115,15 @@ export class SearchDisplayController { await this._onDisplayOptionsUpdated({options: displayOptions}); } + this.setStickyHeaderState(); + } + + /** + * + */ + setStickyHeaderState() { try { - if (this._display.searchStickyHeader()) { - querySelectorNotNull(document, '#sticky_header').classList.add('sticky-header'); - } + querySelectorNotNull(document, '#sticky_header').classList.toggle('sticky-header', this._display.isSearchStickyHeaderEnabled()); } catch (e) { log.error(e); } @@ -183,6 +188,7 @@ export class SearchDisplayController { if (query) { this._display.searchLast(false); } + this.setStickyHeaderState(); } /**