mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
chore: normalize line endings
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user