🐛 Patch alternative ways of applying tokens to shapes

This commit is contained in:
Andrés Moya
2026-02-12 16:01:55 +01:00
parent 375608b44b
commit 11eedd0368
2 changed files with 14 additions and 3 deletions

View File

@@ -16,7 +16,7 @@
[app.main.data.workspace.tokens.application :as dwta]
[app.main.data.workspace.tokens.library-edit :as dwtl]
[app.main.store :as st]
[app.plugins.shape :as shape]
;; [app.plugins.shape :as shape]
[app.plugins.utils :as u]
[app.util.object :as obj]
[beicon.v2.core :as rx]
@@ -113,7 +113,11 @@
:applyToShapes
{: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]]]
:fn (fn [shapes attrs]
(apply-token-to-shapes file-id set-id id (map :id shapes) attrs))}

View File

@@ -251,7 +251,14 @@ function applyToken(
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;
// if (token && selection) {