Skip to content

Commit

Permalink
add view.FindSidebar.activate method and stop writing code in view.Fi…
Browse files Browse the repository at this point in the history
…ndSidebar.focus method
  • Loading branch information
beru committed Sep 19, 2024
1 parent cf7ed23 commit 0dc1d51
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions source/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3766,15 +3766,6 @@ view.FindSidebar = class extends view.Control {
}

focus(state) {
this._state = state || this._state;
this._query.focus();
this._query.value = '';
this._query.value = this._state.query;
for (const [name, toggle] of Object.entries(this._toggles)) {
toggle.checkbox.checked = this._state[name];
toggle.element.setAttribute('title', this._state[name] ? toggle.hide : toggle.show);
}
this._update();
}

_clear() {
Expand Down Expand Up @@ -4019,6 +4010,17 @@ view.FindSidebar = class extends view.Control {
return [this._search, this._content];
}

activate() {
this._query.focus();
this._query.value = '';
this._query.value = this._state.query;
for (const [name, toggle] of Object.entries(this._toggles)) {
toggle.checkbox.checked = this._state[name];
toggle.element.setAttribute('title', this._state[name] ? toggle.hide : toggle.show);
}
this._update();
}

deactivate() {
for (const element of this._focused) {
this._blur(element);
Expand Down

0 comments on commit 0dc1d51

Please sign in to comment.