diff options
author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-05-21 13:15:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 17:15:24 +0000 |
commit | 4f39126ee16cc4be81c94e7c88896615b75b746a (patch) | |
tree | 1ea09880724b2e3ca4d926c667a419589e923f8d /ext/js/pages/settings/dictionary-controller.js | |
parent | 654bb75e4104f0b49cb94a7296ffd8a9a6eb3fc7 (diff) |
Move dictionary up and down buttons out of kebab menu (#971)
* Add up and down buttons to dictionaries list
* Fix text wrapping on firefox when viewport is smaller than dict modal
* Cleanup
* Remove up and down options from kebab menu
* Hide priority under advanced
Diffstat (limited to 'ext/js/pages/settings/dictionary-controller.js')
-rw-r--r-- | ext/js/pages/settings/dictionary-controller.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/js/pages/settings/dictionary-controller.js b/ext/js/pages/settings/dictionary-controller.js index f0450892..291604e4 100644 --- a/ext/js/pages/settings/dictionary-controller.js +++ b/ext/js/pages/settings/dictionary-controller.js @@ -46,6 +46,10 @@ class DictionaryEntry { /** @type {HTMLInputElement} */ this._priorityInput = querySelectorNotNull(fragment, '.dictionary-priority'); /** @type {HTMLButtonElement} */ + this._upButton = querySelectorNotNull(fragment, '#dictionary-move-up'); + /** @type {HTMLButtonElement} */ + this._downButton = querySelectorNotNull(fragment, '#dictionary-move-down'); + /** @type {HTMLButtonElement} */ this._menuButton = querySelectorNotNull(fragment, '.dictionary-menu-button'); /** @type {HTMLButtonElement} */ this._outdatedButton = querySelectorNotNull(fragment, '.dictionary-outdated-button'); @@ -77,6 +81,8 @@ class DictionaryEntry { this._eventListeners.addEventListener(this._enabledCheckbox, 'settingChanged', this._onEnabledChanged.bind(this), false); this._eventListeners.addEventListener(this._menuButton, 'menuOpen', this._onMenuOpen.bind(this), false); this._eventListeners.addEventListener(this._menuButton, 'menuClose', this._onMenuClose.bind(this), false); + this._eventListeners.addEventListener(this._upButton, 'click', (() => { this._move(-1); }).bind(this), false); + this._eventListeners.addEventListener(this._downButton, 'click', (() => { this._move(1); }).bind(this), false); this._eventListeners.addEventListener(this._outdatedButton, 'click', this._onOutdatedButtonClick.bind(this), false); this._eventListeners.addEventListener(this._integrityButton, 'click', this._onIntegrityButtonClick.bind(this), false); } @@ -115,8 +121,6 @@ class DictionaryEntry { _onMenuOpen(e) { const bodyNode = e.detail.menu.bodyNode; const count = this._dictionaryController.dictionaryOptionCount; - this._setMenuActionEnabled(bodyNode, 'moveUp', this._index > 0); - this._setMenuActionEnabled(bodyNode, 'moveDown', this._index < count - 1); this._setMenuActionEnabled(bodyNode, 'moveTo', count > 1); } @@ -131,12 +135,6 @@ class DictionaryEntry { case 'showDetails': this._showDetails(); break; - case 'moveUp': - this._move(-1); - break; - case 'moveDown': - this._move(1); - break; case 'moveTo': this._showMoveToModal(); break; |