mirror of
https://github.com/penpot/penpot.git
synced 2026-05-30 12:18:13 +00:00
🐛 Patch alternative ways of applying tokens to shapes
This commit is contained in:
parent
375608b44b
commit
11eedd0368
@ -16,7 +16,7 @@
|
|||||||
[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.store :as st]
|
[app.main.store :as st]
|
||||||
[app.plugins.shape :as shape]
|
;; [app.plugins.shape :as shape]
|
||||||
[app.plugins.utils :as u]
|
[app.plugins.utils :as u]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
@ -113,7 +113,11 @@
|
|||||||
|
|
||||||
:applyToShapes
|
:applyToShapes
|
||||||
{:schema [:tuple
|
{:schema [:tuple
|
||||||
[:vector [:fn shape/shape-proxy?]]
|
;; FIXME: the schema decoder is interpreting the array of shape-proxys and converting
|
||||||
|
;; them to plain maps. For now we adapt the schema to accept it, but the decoder
|
||||||
|
;; should be fixed to keep the original proxy objects coming from the plugin.
|
||||||
|
;; [:vector [:fn shape/shape-proxy?]]
|
||||||
|
[:vector [:map [:id ::sm/uuid]]]
|
||||||
[:maybe [:set ::sm/keyword]]]
|
[:maybe [:set ::sm/keyword]]]
|
||||||
:fn (fn [shapes attrs]
|
:fn (fn [shapes attrs]
|
||||||
(apply-token-to-shapes file-id set-id id (map :id shapes) attrs))}
|
(apply-token-to-shapes file-id set-id id (map :id shapes) attrs))}
|
||||||
|
|||||||
@ -251,7 +251,14 @@ function applyToken(
|
|||||||
token.applyToSelected(properties);
|
token.applyToSelected(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alternatve way
|
// Alternative way
|
||||||
|
//
|
||||||
|
// const selection = penpot.selection;
|
||||||
|
// if (token && selection) {
|
||||||
|
// token.applyToShapes(selection, properties);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Other alternative way
|
||||||
//
|
//
|
||||||
// const selection = penpot.selection;
|
// const selection = penpot.selection;
|
||||||
// if (token && selection) {
|
// if (token && selection) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user