Skip to content

Open source CapCut alternative.

TypeScript

fix(site): audio rows only register ⌘C with refs, and a dialog owns the library paste

David Le181c03fe7b50
diff --git a/site/src/cut/components/AudioPanel.tsx b/site/src/cut/components/AudioPanel.tsx
index ef5b08a6..5d946e43 100644
--- a/site/src/cut/components/AudioPanel.tsx
+++ b/site/src/cut/components/AudioPanel.tsx
@@ -739,10 +739,12 @@ export function AudioRow({
* the timeline and into a prompt the way it drags. */
refs?: () => AssetRef[];
}) {
+ // A row inside a registered card (the chat's audio cards) registers
+ // nothing of its own, so the card's copy still answers over it.
const copyRef = useRefCopy(refs ?? NO_REFS);
return (
<AudioPillSurface
- ref={copyRef}
+ ref={refs ? copyRef : undefined}
peaks={peaks}
className="audio-row group/row h-10 shrink-0 cursor-grab"
draggable={!!onDragStart}
diff --git a/site/src/cut/components/LibraryView.tsx b/site/src/cut/components/LibraryView.tsx
index 93eba24f..50fe9131 100644
--- a/site/src/cut/components/LibraryView.tsx
+++ b/site/src/cut/components/LibraryView.tsx
@@ -87,7 +87,7 @@ import {
type LibraryData,
} from "@/cut/lib/library";
import { linkFromText, normalizeLink } from "@/cut/lib/link";
-import { isPasteTarget } from "@/cut/lib/shortcutGate";
+import { dialogOnTop, isPasteTarget } from "@/cut/lib/shortcutGate";
import { lightboxItemFromLibrary, useLightbox } from "@/cut/lib/lightbox";
import { reportActivity } from "@/cut/lib/tabActivity";
import { useNewProjectTarget } from "@/cut/lib/newProject";
@@ -574,7 +574,7 @@ export function LibraryView() {
});
useEffect(() => {
const onPaste = (e: ClipboardEvent) => {
- if (e.defaultPrevented || isPasteTarget(e.target)) return;
+ if (e.defaultPrevented || isPasteTarget(e.target) || dialogOnTop()) return;
const files = Array.from(e.clipboardData?.files ?? []);
if (files.length > 0) {
e.preventDefault();