From 0ae01d35bcbc64fd2ff30d0a3a2f567434f566d6 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 20 Mar 2025 15:34:13 +0800 Subject: [PATCH] feat(UndoButton): replace useCodeEditorStore with useProblemEditor --- .../playground/workspace/editor/components/undo-button.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/features/playground/workspace/editor/components/undo-button.tsx b/src/components/features/playground/workspace/editor/components/undo-button.tsx index f2cb480..c6103fc 100644 --- a/src/components/features/playground/workspace/editor/components/undo-button.tsx +++ b/src/components/features/playground/workspace/editor/components/undo-button.tsx @@ -8,10 +8,10 @@ import { } from "@/components/ui/tooltip"; import { Undo2 } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { useCodeEditorStore } from "@/store/useCodeEditorStore"; +import { useProblemEditor } from "@/hooks/use-problem-editor"; -export default function UndoButton() { - const { editor } = useCodeEditorStore(); +export function UndoButton() { + const { editor } = useProblemEditor(); return ( @@ -24,6 +24,7 @@ export default function UndoButton() { onClick={() => { editor?.trigger("undo", "undo", null); }} + disabled={!editor} className="h-6 w-6 px-1.5 py-0.5 border-none shadow-none hover:bg-muted" >