diff --git a/CHANGES.md b/CHANGES.md index 95964b094c..f223538233 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,7 @@ - Fix error activating a set with invalid shadow token applied [Taiga #13528](https://tree.taiga.io/project/penpot/issue/13528) - Fix component "broken" after variant switch [Taiga #12984](https://tree.taiga.io/project/penpot/issue/12984) - Fix incorrect query for file versions [Github #8463](https://github.com/penpot/penpot/pull/8463) +- Fix warning when clicking on number token pills [Taiga #13661](https://tree.taiga.io/project/penpot/issue/13661) ## 2.13.3 diff --git a/frontend/src/app/main/ui/workspace/tokens/management/group.cljs b/frontend/src/app/main/ui/workspace/tokens/management/group.cljs index 08178d5a8c..19c3636e28 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/group.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/group.cljs @@ -76,7 +76,11 @@ is-type-unfolded (contains? (set unfolded-token-paths) (name type)) editing-ref (mf/deref refs/workspace-editor-state) - not-editing? (empty? editing-ref) + edition (mf/deref refs/selected-edition) + objects (mf/deref refs/workspace-page-objects) + not-editing? (and (empty? editing-ref) + (not (and (some? edition) + (= :text (:type (get objects edition)))))) can-edit? (mf/use-ctx ctx/can-edit?) @@ -137,14 +141,16 @@ (fn [event token] (let [token (ctob/get-token tokens-lib selected-token-set-id (:id token))] (dom/stop-propagation event) - (if (and not-editing? (seq selected-shapes) (not= (:type token) :number)) - (st/emit! (dwta/toggle-token {:token token - :shape-ids selected-ids})) - (when (seq selected-shapes) - (st/emit! (ntf/show {:content (tr "workspace.tokens.error-text-edition") - :type :toast - :level :warning - :timeout 3000})))))))] + ;; Number tokens can't be applied via button click + (when (not= (:type token) :number) + (if (and not-editing? (seq selected-shapes)) + (st/emit! (dwta/toggle-token {:token token + :shape-ids selected-ids})) + (when (seq selected-shapes) + (st/emit! (ntf/show {:content (tr "workspace.tokens.error-text-edition") + :type :toast + :level :warning + :timeout 3000}))))))))] [:div {:class (stl/css :token-section-wrapper) :data-testid (dm/str "section-" (name type))}