Skip to content

Commit

Permalink
fix: 基本部分の修正
Browse files Browse the repository at this point in the history
コメントアウトで消すのをやめる
型を書く不要な処理を削除
filterの順番を一般的に速くなりそうな順番に
  • Loading branch information
tsym77yoshi committed Apr 30, 2024
1 parent 9915d02 commit 53b5fc8
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions src/plugins/hotkeyPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export class HotkeyManager {
for (const combination of combinations) {
const bindingKey = combinationToBindingKey(combination.combination);
this.log("Unbind:", bindingKey, "in", combination.editor);
/* this.hotkeys.unbind(bindingKey, combination.editor); */
this.registeredCombinations = this.registeredCombinations.filter(
isNotSameHotkeyTarget(combination)
);
Expand All @@ -191,33 +190,6 @@ export class HotkeyManager {
"in",
action.editor
);
/* this.hotkeys(
combinationToBindingKey(setting.combination),
{ scope: action.editor },
(e) => {
const element = e.target;
// メニュー項目ではショートカットキーを無効化
if (
element instanceof HTMLElement &&
element.classList.contains("q-item")
) {
return;
}
if (!action.enableInTextbox) {
if (
element instanceof HTMLElement &&
(element.tagName === "INPUT" ||
element.tagName === "SELECT" ||
element.tagName === "TEXTAREA" ||
element.contentEditable === "true")
) {
return;
}
}
e.preventDefault();
action.callback(e);
}
); */
this.registeredCombinations = this.registeredCombinations.filter(
isNotSameHotkeyTarget(action)
);
Expand Down Expand Up @@ -291,12 +263,12 @@ export class HotkeyManager {
element.tagName === "TEXTAREA" ||
element.contentEditable === "true");

const combination: HotkeyCombination = eventToCombination(e);
const combination = eventToCombination(e);

const action = this.actions
.filter((item) => item.editor == this.scope)
const action = this.actions
.filter((item) => !isInTextbox || item.enableInTextbox)
.find((item) => this.getSetting(item).combination == combination);
.filter((item) => this.getSetting(item).combination == combination)
.find((item) => item.editor == this.scope);
if (action == null) {
return;
}
Expand Down

0 comments on commit 53b5fc8

Please sign in to comment.