Update hotkey issues (#1244)
* Scroll to the bottom when adding inputs * Skip if empty action
This commit is contained in:
parent
1c5e53a7ac
commit
dc4d659184
@ -30,6 +30,7 @@ class KeyboardShortcutController {
|
|||||||
this._listContainer = null;
|
this._listContainer = null;
|
||||||
this._emptyIndicator = null;
|
this._emptyIndicator = null;
|
||||||
this._stringComparer = new Intl.Collator('en-US'); // Invariant locale
|
this._stringComparer = new Intl.Collator('en-US'); // Invariant locale
|
||||||
|
this._scrollContainer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
get settingsController() {
|
get settingsController() {
|
||||||
@ -44,6 +45,7 @@ class KeyboardShortcutController {
|
|||||||
this._resetButton = document.querySelector('#hotkey-list-reset');
|
this._resetButton = document.querySelector('#hotkey-list-reset');
|
||||||
this._listContainer = document.querySelector('#hotkey-list');
|
this._listContainer = document.querySelector('#hotkey-list');
|
||||||
this._emptyIndicator = document.querySelector('#hotkey-list-empty');
|
this._emptyIndicator = document.querySelector('#hotkey-list-empty');
|
||||||
|
this._scrollContainer = document.querySelector('#keyboard-shortcuts .modal-body');
|
||||||
|
|
||||||
this._addButton.addEventListener('click', this._onAddClick.bind(this));
|
this._addButton.addEventListener('click', this._onAddClick.bind(this));
|
||||||
this._resetButton.addEventListener('click', this._onResetClick.bind(this));
|
this._resetButton.addEventListener('click', this._onResetClick.bind(this));
|
||||||
@ -65,6 +67,7 @@ class KeyboardShortcutController {
|
|||||||
}]);
|
}]);
|
||||||
|
|
||||||
await this._updateOptions();
|
await this._updateOptions();
|
||||||
|
this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteEntry(index) {
|
async deleteEntry(index) {
|
||||||
|
@ -1927,7 +1927,7 @@ class Display extends EventDispatcher {
|
|||||||
this._hotkeys.clear();
|
this._hotkeys.clear();
|
||||||
|
|
||||||
for (const {action, key, modifiers, scopes, enabled} of options.inputs.hotkeys) {
|
for (const {action, key, modifiers, scopes, enabled} of options.inputs.hotkeys) {
|
||||||
if (!enabled || !scopes.includes(this._pageType)) { continue; }
|
if (!enabled || action === '' || !scopes.includes(this._pageType)) { continue; }
|
||||||
this._registerHotkey(key, modifiers, action);
|
this._registerHotkey(key, modifiers, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user