mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
feat: enhance keybinding management by integrating keybindingsEnabled state and updating related hooks
This commit is contained in:
@@ -43,6 +43,7 @@ export interface KeybindingConflict {
|
||||
interface KeybindingsState {
|
||||
keybindings: KeybindingConfig;
|
||||
isCustomized: boolean;
|
||||
keybindingsEnabled: boolean;
|
||||
|
||||
// Actions
|
||||
updateKeybinding: (key: string, action: ActionWithOptionalArgs) => void;
|
||||
@@ -50,6 +51,8 @@ interface KeybindingsState {
|
||||
resetToDefaults: () => void;
|
||||
importKeybindings: (config: KeybindingConfig) => void;
|
||||
exportKeybindings: () => KeybindingConfig;
|
||||
enableKeybindings: () => void;
|
||||
disableKeybindings: () => void;
|
||||
|
||||
// Validation
|
||||
validateKeybinding: (
|
||||
@@ -67,6 +70,7 @@ export const useKeybindingsStore = create<KeybindingsState>()(
|
||||
(set, get) => ({
|
||||
keybindings: { ...defaultKeybindings },
|
||||
isCustomized: false,
|
||||
keybindingsEnabled: true,
|
||||
|
||||
updateKeybinding: (key: string, action: ActionWithOptionalArgs) => {
|
||||
set((state) => {
|
||||
@@ -99,6 +103,14 @@ export const useKeybindingsStore = create<KeybindingsState>()(
|
||||
});
|
||||
},
|
||||
|
||||
enableKeybindings: () => {
|
||||
set({ keybindingsEnabled: true });
|
||||
},
|
||||
|
||||
disableKeybindings: () => {
|
||||
set({ keybindingsEnabled: false });
|
||||
},
|
||||
|
||||
importKeybindings: (config: KeybindingConfig) => {
|
||||
set({
|
||||
keybindings: { ...config },
|
||||
|
||||
Reference in New Issue
Block a user