Skip to content

Commit

Permalink
[FB] CSK | Use old component for disable exist old key bind
Browse files Browse the repository at this point in the history
  • Loading branch information
surapunoyousei committed Sep 29, 2024
1 parent 8b7d20a commit 363b4ee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions nora/dist/content.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nora/dist/content.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions nora/src/components/custom-shortcut-key/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export class CustomShortcutKey {
CustomShortcutKey.instance = new CustomShortcutKey();
}
if (!CustomShortcutKey.windows.includes(window)) {
if (Services.prefs.getBoolPref("floorp.custom.shortcutkeysAndActions.remove.fx.actions", false)) {
CustomShortcutKey.instance.disableAllCustomKeyShortcut();
}

CustomShortcutKey.instance.startHandleShortcut(window);
CustomShortcutKey.windows.push(window);
//console.log("add window");
Expand Down Expand Up @@ -75,6 +79,16 @@ export class CustomShortcutKey {
this.getCSKData(),
);
}

private disableAllCustomKeyShortcut() {
const keyElems = document?.querySelector("#mainKeyset")?.childNodes as NodeListOf<Element>;
for (const keyElem of keyElems) {
if (!keyElem.classList.contains("floorpCustomShortcutKey")) {
keyElem.setAttribute("disabled", true);
}
}
}

private startHandleShortcut(_window: Window) {
_window.addEventListener("keydown", (ev: any) => {
if (this.disable_csk) {
Expand Down

0 comments on commit 363b4ee

Please sign in to comment.