summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor-provider.tsx
diff options
context:
space:
mode:
authorAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 07:08:57 +0600
committerAnwarul Islam <anwaarulislaam@gmail.com>2025-07-18 07:08:57 +0600
commitf3bffae7ea015ef18b36b1b447e2c857d898d522 (patch)
tree5b0deb5bbdec5c0ec9d6f3e0f1e0f6ed95d1c25b /apps/web/src/components/editor-provider.tsx
parent7eda7975fcc06a9fa3d88975c84ccc07748298cb (diff)
downloadopencut-f3bffae7ea015ef18b36b1b447e2c857d898d522.tar.gz
Refactor editor provider to integrate keybinding management and action handlers
Diffstat (limited to 'apps/web/src/components/editor-provider.tsx')
-rw-r--r--apps/web/src/components/editor-provider.tsx25
1 files changed, 20 insertions, 5 deletions
diff --git a/apps/web/src/components/editor-provider.tsx b/apps/web/src/components/editor-provider.tsx
index d970f86d..ae1bb1a5 100644
--- a/apps/web/src/components/editor-provider.tsx
+++ b/apps/web/src/components/editor-provider.tsx
@@ -3,7 +3,11 @@
import { useEffect } from "react";
import { Loader2 } from "lucide-react";
import { useEditorStore } from "@/stores/editor-store";
-import { useKeyboardShortcuts } from "@/hooks/use-keyboard-shortcuts";
+import {
+ useKeybindingsListener,
+ useKeybindingDisabler,
+} from "@/constants/keybindings";
+import { useEditorActions } from "@/hooks/use-editor-actions";
interface EditorProviderProps {
children: React.ReactNode;
@@ -11,11 +15,22 @@ interface EditorProviderProps {
export function EditorProvider({ children }: EditorProviderProps) {
const { isInitializing, isPanelsReady, initializeApp } = useEditorStore();
+ const { disableKeybindings, enableKeybindings } = useKeybindingDisabler();
- useKeyboardShortcuts({
- enabled: !isInitializing && isPanelsReady,
- context: "editor",
- });
+ // Set up action handlers
+ useEditorActions();
+
+ // Set up keybinding listener
+ useKeybindingsListener();
+
+ // Disable keybindings when initializing
+ useEffect(() => {
+ if (isInitializing || !isPanelsReady) {
+ disableKeybindings();
+ } else {
+ enableKeybindings();
+ }
+ }, [isInitializing, isPanelsReady, disableKeybindings, enableKeybindings]);
useEffect(() => {
initializeApp();