mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 12:29:00 +00:00
🐛 Add notification to token applied during text edition (#8434)
This commit is contained in:
parent
c72e9ee1a0
commit
47dae090ed
@ -620,7 +620,7 @@
|
|||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
;; We do not allow to apply tokens while text editor is open.
|
;; We do not allow to apply tokens while text editor is open.
|
||||||
(when (empty? (get state :workspace-editor-state))
|
(if (empty? (get state :workspace-editor-state))
|
||||||
(let [attributes-to-remove
|
(let [attributes-to-remove
|
||||||
;; Remove atomic typography tokens when applying composite and vice-verca
|
;; Remove atomic typography tokens when applying composite and vice-verca
|
||||||
(cond
|
(cond
|
||||||
@ -674,7 +674,11 @@
|
|||||||
(if (rx/observable? res)
|
(if (rx/observable? res)
|
||||||
res
|
res
|
||||||
(rx/of res))))
|
(rx/of res))))
|
||||||
(rx/of (dwu/commit-undo-transaction undo-id)))))))))))))
|
(rx/of (dwu/commit-undo-transaction undo-id)))))))))
|
||||||
|
(rx/of (ntf/show {:content (tr "workspace.tokens.error-text-edition")
|
||||||
|
:type :toast
|
||||||
|
:level :warning
|
||||||
|
:timeout 3000}))))))
|
||||||
|
|
||||||
(defn apply-spacing-token-separated
|
(defn apply-spacing-token-separated
|
||||||
"Handles edge-case for spacing token when applying token via toggle button.
|
"Handles edge-case for spacing token when applying token via toggle button.
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.types.tokens-lib :as ctob]
|
[app.common.types.tokens-lib :as ctob]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
|
[app.main.data.notifications :as ntf]
|
||||||
[app.main.data.workspace.tokens.application :as dwta]
|
[app.main.data.workspace.tokens.application :as dwta]
|
||||||
[app.main.data.workspace.tokens.library-edit :as dwtl]
|
[app.main.data.workspace.tokens.library-edit :as dwtl]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
@ -136,9 +137,13 @@
|
|||||||
(fn [event token]
|
(fn [event token]
|
||||||
(let [token (ctob/get-token tokens-lib selected-token-set-id (:id token))]
|
(let [token (ctob/get-token tokens-lib selected-token-set-id (:id token))]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(when (and not-editing? (seq selected-shapes) (not= (:type token) :number))
|
(if (and not-editing? (seq selected-shapes) (not= (:type token) :number))
|
||||||
(st/emit! (dwta/toggle-token {:token token
|
(st/emit! (dwta/toggle-token {:token token
|
||||||
:shape-ids selected-ids}))))))]
|
:shape-ids selected-ids}))
|
||||||
|
(st/emit! (ntf/show {:content (tr "workspace.tokens.error-text-edition")
|
||||||
|
:type :toast
|
||||||
|
:level :warning
|
||||||
|
:timeout 3000}))))))]
|
||||||
|
|
||||||
[:div {:class (stl/css :token-section-wrapper)
|
[:div {:class (stl/css :token-section-wrapper)
|
||||||
:data-testid (dm/str "section-" (name type))}
|
:data-testid (dm/str "section-" (name type))}
|
||||||
|
|||||||
@ -8366,6 +8366,10 @@ msgstr "Invalid value: Units are not allowed."
|
|||||||
msgid "workspace.tokens.warning-name-change"
|
msgid "workspace.tokens.warning-name-change"
|
||||||
msgstr "Renaming this token will break any reference to its old name"
|
msgstr "Renaming this token will break any reference to its old name"
|
||||||
|
|
||||||
|
#: src/app/main/data/workspace/tokens/application.cljs
|
||||||
|
msgid "workspace.tokens.error-text-edition"
|
||||||
|
msgstr "Tokens can't be applied while editing text. Select the text layer instead."
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar.cljs:159, src/app/main/ui/workspace/sidebar.cljs:166
|
#: src/app/main/ui/workspace/sidebar.cljs:159, src/app/main/ui/workspace/sidebar.cljs:166
|
||||||
msgid "workspace.toolbar.assets"
|
msgid "workspace.toolbar.assets"
|
||||||
msgstr "Assets"
|
msgstr "Assets"
|
||||||
|
|||||||
@ -8246,6 +8246,10 @@ msgstr ""
|
|||||||
"Cambiar el nombre de este token romperá cualquier referencia a su nombre "
|
"Cambiar el nombre de este token romperá cualquier referencia a su nombre "
|
||||||
"anterior."
|
"anterior."
|
||||||
|
|
||||||
|
#: src/app/main/data/workspace/tokens/application.cljs
|
||||||
|
msgid "workspace.tokens.error-text-edition"
|
||||||
|
msgstr "No se pueden aplicar tokens mientras se edita texto. Seleccione la capa de texto en su lugar."
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar.cljs:159, src/app/main/ui/workspace/sidebar.cljs:166
|
#: src/app/main/ui/workspace/sidebar.cljs:159, src/app/main/ui/workspace/sidebar.cljs:166
|
||||||
msgid "workspace.toolbar.assets"
|
msgid "workspace.toolbar.assets"
|
||||||
msgstr "Recursos"
|
msgstr "Recursos"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user