Skip to content

Commit

Permalink
react to config change
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-ojisan committed Jul 5, 2024
1 parent dd23483 commit ffb4461
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ext/js/display/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 9 additions & 3 deletions ext/js/display/search-display-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -183,6 +188,7 @@ export class SearchDisplayController {
if (query) {
this._display.searchLast(false);
}
this.setStickyHeaderState();
}

/**
Expand Down

0 comments on commit ffb4461

Please sign in to comment.