diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-27 00:55:15 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:56:48 +0200 |
| commit | 4d127a038bf768eded68aae3cfa5c1b12241bdac (patch) | |
| tree | 16bbb801caf6770546cff4fdb37b6408ec9ead98 /apps/web/src/hooks/use-menu-preview.ts | |
| parent | 82817cb50cb0487350573d6129130aec705f924b (diff) | |
| download | opencut-4d127a038bf768eded68aae3cfa5c1b12241bdac.tar.gz | |
chore: normalize line endings
Diffstat (limited to 'apps/web/src/hooks/use-menu-preview.ts')
| -rw-r--r-- | apps/web/src/hooks/use-menu-preview.ts | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/apps/web/src/hooks/use-menu-preview.ts b/apps/web/src/hooks/use-menu-preview.ts index a17ee278..a3c14489 100644 --- a/apps/web/src/hooks/use-menu-preview.ts +++ b/apps/web/src/hooks/use-menu-preview.ts @@ -1,26 +1,26 @@ -import { useRef } from "react"; -import { useEditor } from "@/hooks/use-editor"; - -export function useMenuPreview() { - const editor = useEditor(); - const didCommitRef = useRef(false); - - const discard = () => { - if (!didCommitRef.current && editor.timeline.isPreviewActive()) { - editor.timeline.discardPreview(); - } - }; - - const markCommitted = () => { - didCommitRef.current = true; - }; - - const onOpenChange = (isOpen: boolean) => { - if (!isOpen) { - discard(); - didCommitRef.current = false; - } - }; - - return { onPointerLeave: discard, onOpenChange, markCommitted }; -} +import { useRef } from "react";
+import { useEditor } from "@/hooks/use-editor";
+
+export function useMenuPreview() {
+ const editor = useEditor();
+ const didCommitRef = useRef(false);
+
+ const discard = () => {
+ if (!didCommitRef.current && editor.timeline.isPreviewActive()) {
+ editor.timeline.discardPreview();
+ }
+ };
+
+ const markCommitted = () => {
+ didCommitRef.current = true;
+ };
+
+ const onOpenChange = (isOpen: boolean) => {
+ if (!isOpen) {
+ discard();
+ didCommitRef.current = false;
+ }
+ };
+
+ return { onPointerLeave: discard, onOpenChange, markCommitted };
+}
|
