Skip to content

Commit

Permalink
hotkeyPlugin内で初期設定を消す
Browse files Browse the repository at this point in the history
  • Loading branch information
tsym77yoshi committed May 28, 2024
1 parent 78734f1 commit 7bd034a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/plugins/hotkeyPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class HotkeyManager {
/** 登録されたHotkeyAction */
private actions: HotkeyAction[] = [];
/** スコープ */
private scope: EditorType = "talk";
private scope: EditorType | undefined;
/** ユーザーのショートカットキー設定 */
private settings: HotkeySettingType[] | undefined; // ユーザーのショートカットキー設定
/** 登録されたショートカットキーの組み合わせ */
Expand Down Expand Up @@ -227,6 +227,12 @@ export class HotkeyManager {

keyInput(e: KeyboardEvent): void {
const element = e.target;

if (this.scope == undefined) {
console.error("hotkeyPluginのスコープが未設定です");
return;
}

// メニュー項目・ダイアログではショートカットキーを無効化
if (
element instanceof HTMLElement &&
Expand All @@ -252,7 +258,10 @@ export class HotkeyManager {
combinationToBindingKey(this.getSetting(item).combination) ==
combination,
)
.filter((item) => item.editor.split("&").includes(this.scope));
.filter((item) =>
// エラー表記を回避するために三項演算子を利用
item.editor.split("&").includes(this.scope ? this.scope : ""),
);
if (actions.length == 0) {
return;
}
Expand Down

0 comments on commit 7bd034a

Please sign in to comment.