diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsx index f090484f77..79f8820ae2 100644 --- a/apps/desktop/src/routes/editor/Player.tsx +++ b/apps/desktop/src/routes/editor/Player.tsx @@ -146,50 +146,57 @@ export function Player() { }; // Register keyboard shortcuts in one place - useEditorShortcuts( - () => document.activeElement === document.body, - [ - { - combo: "S", - handler: () => - setEditorState( - "timeline", - "interactMode", - editorState.timeline.interactMode === "split" ? "seek" : "split", - ), - }, - { - combo: "Mod+=", - handler: () => - editorState.timeline.transform.updateZoom( - editorState.timeline.transform.zoom / 1.1, - editorState.playbackTime, - ), - }, - { - combo: "Mod+-", - handler: () => - editorState.timeline.transform.updateZoom( - editorState.timeline.transform.zoom * 1.1, - editorState.playbackTime, - ), - }, - { - combo: "Space", - handler: async () => { - const prevTime = editorState.previewTime; - - if (!editorState.playing) { - if (prevTime !== null) setEditorState("playbackTime", prevTime); - - await commands.seekTo(Math.floor(editorState.playbackTime * FPS)); - } + useEditorShortcuts(() => { + const el = document.activeElement; + if (!el) return true; + const tagName = el.tagName.toLowerCase(); + const isContentEditable = el.getAttribute("contenteditable") === "true"; + return !( + tagName === "input" || + tagName === "textarea" || + isContentEditable + ); + }, [ + { + combo: "S", + handler: () => + setEditorState( + "timeline", + "interactMode", + editorState.timeline.interactMode === "split" ? "seek" : "split", + ), + }, + { + combo: "Mod+=", + handler: () => + editorState.timeline.transform.updateZoom( + editorState.timeline.transform.zoom / 1.1, + editorState.playbackTime, + ), + }, + { + combo: "Mod+-", + handler: () => + editorState.timeline.transform.updateZoom( + editorState.timeline.transform.zoom * 1.1, + editorState.playbackTime, + ), + }, + { + combo: "Space", + handler: async () => { + const prevTime = editorState.previewTime; + + if (!editorState.playing) { + if (prevTime !== null) setEditorState("playbackTime", prevTime); + + await commands.seekTo(Math.floor(editorState.playbackTime * FPS)); + } - await handlePlayPauseClick(); - }, + await handlePlayPauseClick(); }, - ], - ); + }, + ]); return (
diff --git a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx index b75b36a68e..6e7c324236 100644 --- a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx +++ b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx @@ -309,30 +309,34 @@ export function ClipTrack( if (m.type === "single") return m.value; })()} > - {(marker) => ( -
- { - const m = marker(); - return m.type === "time" ? m.time : 0; - })()} - onClick={() => { - setProject( - "timeline", - "segments", - produce((s) => { - if (marker().type === "reset") { - s[i() - 1].end = s[i()].end; - s.splice(i(), 1); - } else { - s[i() - 1].end = s[i()].start; - } - }), - ); - }} - /> -
- )} + {(markerValue) => { + const value = createMemo(() => { + const m = markerValue(); + return m.type === "time" ? m.time : 0; + }); + + return ( +
+ { + setProject( + "timeline", + "segments", + produce((s) => { + if (markerValue().type === "reset") { + s[i() - 1].end = s[i()].end; + s.splice(i(), 1); + } else { + s[i() - 1].end = s[i()].start; + } + }), + ); + }} + /> +
+ ); + }} { @@ -345,16 +349,16 @@ export function ClipTrack( return m.right; })()} > - {(marker) => { - const markerValue = marker(); + {(markerValue) => { + const value = createMemo(() => { + const m = markerValue(); + return m.type === "time" ? m.time : 0; + }); + return (
{ setProject( @@ -684,34 +688,38 @@ export function ClipTrack( return m.left; })()} > - {(marker) => ( -
-
-
- { - const m = marker(); - return m.type === "time" ? m.time : 0; - })()} - class="-right-px absolute rounded-l-full !pr-1.5 rounded-tr-full" - onClick={() => { - setProject( - "timeline", - "segments", - i(), - "end", - segmentRecording().display.duration, - ); - }} - /> + {(markerValue) => { + const value = createMemo(() => { + const m = markerValue(); + return m.type === "time" ? m.time : 0; + }); + + return ( +
+
+
+ { + setProject( + "timeline", + "segments", + i(), + "end", + segmentRecording().display.duration, + ); + }} + /> +
-
- )} + ); + }} ); @@ -770,11 +778,12 @@ function CutOffsetButton(props: { )} onClick={() => props.onClick?.()} > - {props.value === 0 ? ( - - ) : ( - formatTime(props.value) - )} + } + > + {formatTime(props.value)} + ); }