From 4f39126ee16cc4be81c94e7c88896615b75b746a Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Tue, 21 May 2024 13:15:24 -0400 Subject: 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 --- ext/js/pages/settings/dictionary-controller.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'ext/js') 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; -- cgit v1.2.3