diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 1b862b22d..bc76f0108 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -291,6 +291,16 @@ (on-switch-to-radius-4) (on-switch-to-radius-1)))) + on-border-radius-token-unlink + (mf/use-fn + (mf/deps ids change-radius border-radius-tokens) + (fn [token] + (let [token-value (some-> token wtc/resolve-token-value)] + (st/emit! + (change-radius (fn [shape] + (-> (update shape :applied-tokens d/without-keys #{:rx :ry :r1 :r2 :r3 :r4}) + (ctsr/set-radius-1 token-value)))))))) + on-radius-1-change (mf/use-fn (mf/deps ids change-radius border-radius-tokens) @@ -302,6 +312,7 @@ (-> (dt/maybe-apply-token-to-shape {:token token :shape shape :attributes (wtc/token-attributes :border-radius)}) + (doto js/console.log) (ctsr/set-radius-1 (or token-value value))))))))) on-radius-multi-change @@ -488,6 +499,7 @@ [:span {:class (stl/css :icon)} i/corner-radius] [:& editable-select {:placeholder (if (= :multiple (:rx values)) (tr "settings.multiple") "--") + :on-token-remove on-border-radius-token-unlink :class (stl/css :token-select) :type "number" :min 0 diff --git a/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs b/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs index be3212af4..a491ba222 100644 --- a/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs @@ -59,7 +59,7 @@ [:span {:class (stl/css :check-icon)} i/tick]])))]]]) (mf/defc editable-select - [{:keys [value type options class on-change placeholder on-blur input-class] :as params}] + [{:keys [value type options class on-change placeholder on-blur input-class on-token-remove] :as params}] (let [state* (mf/use-state {:id (uuid/next) :is-open? false :current-value value @@ -79,7 +79,6 @@ multiple? (= :multiple value) token (when-not multiple? (-> (filter :selected? options) (first))) - _ (js/console.log "token" token) emit-blur? (mf/use-ref nil) select-wrapper-ref (mf/use-ref) @@ -156,9 +155,11 @@ (cond token (let [backspace? (kbd/backspace? event) value (-> event dom/get-target dom/get-value) - caret-at-beginning? (= 0 (.. event -target -selectionStart))] + caret-at-beginning? (nil? (.. event -target -selectionStart))] (cond - (and backspace? caret-at-beginning?) (set-value "") + (and backspace? caret-at-beginning?) (do + (dom/prevent-default event) + (on-token-remove token)) :else (set-token-value! value)) (js/console.log "backspace?" caret-at-beginning? (.. event -target))) is-open? (let [up? (kbd/up-arrow? event)