From c4d1a1bc94a1bdf0ba4543663fecb52970312fab Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Tue, 11 Aug 2026 13:03:29 +0200 Subject: [PATCH] :bug: Fix node deleting (#11126) * :bug: Fix delete path node * :bug: Fix typography on shortcuts list --- frontend/src/app/main/data/shortcuts.cljs | 35 +++++++++++-------- .../main/data/workspace/path/shortcuts.cljs | 8 ++++- frontend/src/app/main/ui/shortcuts.scss | 3 +- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/frontend/src/app/main/data/shortcuts.cljs b/frontend/src/app/main/data/shortcuts.cljs index 19a473ae54..fa5e86e547 100644 --- a/frontend/src/app/main/data/shortcuts.cljs +++ b/frontend/src/app/main/data/shortcuts.cljs @@ -204,20 +204,27 @@ (defn- bind! [shortcuts] - (->> shortcuts - (remove #(:disabled (second %))) - (run! (fn [[key {:keys [command fn type overwrite]}]] - (let [callback (wrap-cb key fn) - commands (if (vector? command) - (into-array command) - #js [command])] - (if (vector? type) - (do (mousetrap/bind commands callback (nth type 0) overwrite) - (mousetrap/bind commands callback (nth type 1) overwrite)) - (let [undefined (js* "(void 0)")] - (if type - (mousetrap/bind commands callback type overwrite) - (mousetrap/bind commands callback undefined overwrite))))))))) + (let [entries (remove #(:disabled (second %)) shortcuts) + bind-fn (fn [[key {:keys [command fn type overwrite]}]] + (let [callback (wrap-cb key fn) + commands (if (vector? command) + (into-array command) + #js [command])] + (if (vector? type) + (do (mousetrap/bind commands callback (nth type 0) overwrite) + (mousetrap/bind commands callback (nth type 1) overwrite)) + (let [undefined (js* "(void 0)")] + (if type + (mousetrap/bind commands callback type overwrite) + (mousetrap/bind commands callback undefined overwrite))))))] + ;; Bind non-overwrite entries first so that entries flagged with + ;; `:overwrite` are bound last and can reliably splice out the + ;; colliding callbacks bound earlier (mousetrap's overwrite only + ;; removes callbacks that were already registered for the same + ;; combo). Map iteration order is hash-based, so we must force the + ;; order explicitly. + (run! bind-fn (remove (comp :overwrite second) entries)) + (run! bind-fn (filter (comp :overwrite second) entries)))) (defn- reset! ([] diff --git a/frontend/src/app/main/data/workspace/path/shortcuts.cljs b/frontend/src/app/main/data/workspace/path/shortcuts.cljs index fe35b33e40..f4ed3dd8f3 100644 --- a/frontend/src/app/main/data/workspace/path/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/path/shortcuts.cljs @@ -37,6 +37,7 @@ :command "p" :subsections [:path-editor] :section [:workspace] + :overwrite true :fn #(st/emit! (drp/change-edit-mode :draw))} :add-node {:tooltip (ds/shift "+") @@ -49,7 +50,9 @@ :command ["del" "backspace"] :subsections [:path-editor] :section [:workspace] - :fn #(st/emit! (drp/remove-node))} + :overwrite true + :fn #(st/emit! + (drp/remove-node))} :merge-nodes {:tooltip (ds/meta "J") :command (ds/c-mod "j") @@ -67,6 +70,7 @@ :command "k" :subsections [:path-editor] :section [:workspace] + :overwrite true :fn #(st/emit! (drp/separate-nodes))} :make-corner {:tooltip "X" @@ -79,6 +83,7 @@ :command "c" :subsections [:path-editor] :section [:workspace] + :overwrite true :fn #(st/emit! (drp/make-curve))} :snap-nodes {:tooltip (ds/meta "'") @@ -91,6 +96,7 @@ :escape {:tooltip (ds/esc) :command ["escape" "enter" "v"] :section [:workspace] + :overwrite true :fn #(st/emit! (esc-pressed))} :undo {:tooltip (ds/meta "Z") diff --git a/frontend/src/app/main/ui/shortcuts.scss b/frontend/src/app/main/ui/shortcuts.scss index 7d582e4e71..b92405e5c4 100644 --- a/frontend/src/app/main/ui/shortcuts.scss +++ b/frontend/src/app/main/ui/shortcuts.scss @@ -21,7 +21,7 @@ .section-title, .subsection-title { - @include t.use-typography("title-small"); + @include t.use-typography("headline-small"); display: flex; align-items: center; @@ -43,6 +43,7 @@ } .subsection-title { + block-size: $sz-32; text-transform: none; padding-inline-start: var(--sp-m); }