Skip to content

🎥 Make videos programmatically with React

make event optional

Jonny Burger97e1d889107b
diff --git a/packages/cli/src/editor/components/MenuToolbar.tsx b/packages/cli/src/editor/components/MenuToolbar.tsx
index 3171930b0c..074748236a 100644
--- a/packages/cli/src/editor/components/MenuToolbar.tsx
+++ b/packages/cli/src/editor/components/MenuToolbar.tsx
@@ -348,7 +348,7 @@ export const MenuToolbar: React.FC = () => {
leftItem: null,
onClick: () => {
close();
- inOutHandles.current?.inMarkClick();
+ inOutHandles.current?.inMarkClick(null);
},
subMenu: null,
type: 'item' as const,
@@ -361,7 +361,7 @@ export const MenuToolbar: React.FC = () => {
leftItem: null,
onClick: () => {
close();
- inOutHandles.current?.outMarkClick();
+ inOutHandles.current?.outMarkClick(null);
},
subMenu: null,
type: 'item' as const,
diff --git a/packages/cli/src/editor/components/TimelineInOutToggle.tsx b/packages/cli/src/editor/components/TimelineInOutToggle.tsx
index 32c6c43cc8..68d606db73 100644
--- a/packages/cli/src/editor/components/TimelineInOutToggle.tsx
+++ b/packages/cli/src/editor/components/TimelineInOutToggle.tsx
@@ -38,8 +38,8 @@ const style: React.CSSProperties = {
};
export const inOutHandles = createRef<{
- inMarkClick: (e: KeyboardEvent) => void;
- outMarkClick: (e: KeyboardEvent) => void;
+ inMarkClick: (e: KeyboardEvent | null) => void;
+ outMarkClick: (e: KeyboardEvent | null) => void;
clearMarks: () => void;
setMarks: (marks: [number | null, number | null]) => void;
}>();
@@ -63,12 +63,12 @@ export const TimelineInOutPointToggle: React.FC = () => {
}, [setInAndOutFrames]);
const onInMark = useCallback(
- (e: KeyboardEvent | React.MouseEvent) => {
+ (e: KeyboardEvent | React.MouseEvent | null) => {
if (!videoConfig) {
return null;
}
- if (e.shiftKey) {
+ if (e?.shiftKey) {
setInAndOutFrames((f) => {
return {
...f,
@@ -128,12 +128,12 @@ export const TimelineInOutPointToggle: React.FC = () => {
);
const clearOutMark = useCallback(
- (e: React.MouseEvent) => {
+ (e: React.MouseEvent | null) => {
if (!videoConfig) {
return null;
}
- e.preventDefault();
+ e?.preventDefault();
setInAndOutFrames((f) => {
return {
@@ -146,12 +146,12 @@ export const TimelineInOutPointToggle: React.FC = () => {
);
const onOutMark = useCallback(
- (e: KeyboardEvent | React.MouseEvent) => {
+ (e: KeyboardEvent | React.MouseEvent | null) => {
if (!videoConfig) {
return null;
}
- if (e.shiftKey) {
+ if (e?.shiftKey) {
setInAndOutFrames((f) => {
return {
...f,