mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(UndoButton): replace useCodeEditorStore with useProblemEditor
This commit is contained in:
parent
a6595c51db
commit
0ae01d35bc
@ -8,10 +8,10 @@ import {
|
|||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { Undo2 } from "lucide-react";
|
import { Undo2 } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
import { useProblemEditor } from "@/hooks/use-problem-editor";
|
||||||
|
|
||||||
export default function UndoButton() {
|
export function UndoButton() {
|
||||||
const { editor } = useCodeEditorStore();
|
const { editor } = useProblemEditor();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider delayDuration={0}>
|
<TooltipProvider delayDuration={0}>
|
||||||
@ -24,6 +24,7 @@ export default function UndoButton() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
editor?.trigger("undo", "undo", null);
|
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"
|
className="h-6 w-6 px-1.5 py-0.5 border-none shadow-none hover:bg-muted"
|
||||||
>
|
>
|
||||||
<Undo2 size={16} strokeWidth={2} aria-hidden="true" />
|
<Undo2 size={16} strokeWidth={2} aria-hidden="true" />
|
||||||
|
Loading…
Reference in New Issue
Block a user