From c4040c789c06287bee6ffc90b975be8a397d64f5 Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sun, 11 Oct 2026 00:09:11 -0400 Subject: [PATCH] Copy, cut, paste and duplicate on the timeline's bar The edit menu went, and with it the only way to reach the clipboard without a keyboard, which a phone does not have. They are icons in the selection group: copy, cut and duplicate while something is selected, paste while something is copied. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9 --- frontend/src/arthur/ui/icon.cljs | 10 +++++++++- frontend/src/arthur/ui/timeline.cljs | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/frontend/src/arthur/ui/icon.cljs b/frontend/src/arthur/ui/icon.cljs index f901403..056836f 100644 --- a/frontend/src/arthur/ui/icon.cljs +++ b/frontend/src/arthur/ui/icon.cljs @@ -65,7 +65,15 @@ ;; A new drawing in a lane: a sheet, with a line on it — the one at the ;; playhead carried on — or bare. :drawing {:stroke ["M3 1.5h4.5l2 2v7h-6.5z" "M4.6 7.8 5.9 6.1 7.4 7.3"]} - :blank {:stroke ["M3 1.5h4.5l2 2v7h-6.5z"]}}) + :blank {:stroke ["M3 1.5h4.5l2 2v7h-6.5z"]} + ;; The clipboard, as every editor draws it: two sheets, scissors, a board, + ;; and two sheets with one more. + :copy {:stroke ["M4.5 4.5h5v5h-5z" "M2.5 7.5v-5h5"]} + :cut {:stroke ["M2 9a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0 -3 0" + "M7 9a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0 -3 0" + "M4.4 7.8 8.5 2" "M7.6 7.8 3.5 2"]} + :paste {:stroke ["M3.8 2.5H2.5v8h7v-8H8.2" "M4.5 1.5h3v2h-3z"]} + :duplicate {:stroke ["M4.5 4.5h5v5h-5z" "M2.5 7.5v-5h5" "M7 5.8v2.4" "M5.8 7h2.4"]}}) (defn view "The glyph named `k`, sized by CSS and inked in `currentColor` — so a button's diff --git a/frontend/src/arthur/ui/timeline.cljs b/frontend/src/arthur/ui/timeline.cljs index 8f00d74..be6efdd 100644 --- a/frontend/src/arthur/ui/timeline.cljs +++ b/frontend/src/arthur/ui/timeline.cljs @@ -605,6 +605,7 @@ here @(rf/subscribe [::here]) marks @(rf/subscribe [::playback/range]) selections @(rf/subscribe [::sub/selections]) + clipboard @(rf/subscribe [::sub/clipboard]) ;; A peg goes over ONE node: it takes that node's place in the ;; hierarchy, and there is no one place a pair of them would go. one-node (when (= 1 (count selections)) @@ -698,6 +699,20 @@ (when cuttable? [:button {:title "split the selected clip at the playhead" :on-click (act [::ui/split])} "split"]) + ;; THE CLIPBOARD, which has keys everywhere but a phone. Copy, cut and + ;; duplicate while something is selected, paste while something is + ;; copied. + (when (seq selections) + [:<> + [:button.ico {:aria-label "copy" :title "copy (⌘C)" + :on-click (act [::ui/copy])} [icon/view :copy]] + [:button.ico {:aria-label "cut" :title "cut (⌘X)" + :on-click (act [::ui/cut])} [icon/view :cut]] + [:button.ico {:aria-label "duplicate" :title "duplicate beside it (⌘D)" + :on-click (act [::ui/duplicate])} [icon/view :duplicate]]]) + (when clipboard + [:button.ico {:aria-label "paste" :title "paste at the playhead (⌘V)" + :on-click (act [::ui/paste])} [icon/view :paste]]) (when (and one-node (not lane?)) ;; The only way to keep a pivot, and the only way to transform a ;; measured part by hand — which is what `gesture/refusal` tells you