mirror of
https://github.com/penpot/penpot.git
synced 2025-04-05 19:41:27 -05:00
🐛 Fix rename layers for plugins
This commit is contained in:
parent
f052c81ee1
commit
411fe5448b
2 changed files with 12 additions and 5 deletions
|
@ -967,13 +967,13 @@
|
|||
(mf/use-fn
|
||||
(mf/deps (:id shape))
|
||||
(fn []
|
||||
(st/emit! (st/emit! (dwsl/add-layout-track [(:id shape)] :column ctl/default-track-value)))))
|
||||
(st/emit! (dwsl/add-layout-track [(:id shape)] :column ctl/default-track-value))))
|
||||
|
||||
handle-add-row
|
||||
(mf/use-fn
|
||||
(mf/deps (:id shape))
|
||||
(fn []
|
||||
(st/emit! (st/emit! (dwsl/add-layout-track [(:id shape)] :row ctl/default-track-value)))))
|
||||
(st/emit! (dwsl/add-layout-track [(:id shape)] :row ctl/default-track-value))))
|
||||
|
||||
target-tracks* (mf/use-ref nil)
|
||||
drop-track-type* (mf/use-state nil)
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
[app.plugins.utils :as u]
|
||||
[app.util.object :as obj]
|
||||
[app.util.path.format :as upf]
|
||||
[app.util.text-editor :as ted]))
|
||||
[app.util.text-editor :as ted]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(declare shape-proxy)
|
||||
|
||||
|
@ -176,8 +177,14 @@
|
|||
{:name "name"
|
||||
:get #(-> % u/proxy->shape :name)
|
||||
:set (fn [self value]
|
||||
(let [id (obj/get self "$id")]
|
||||
(st/emit! (dwsh/update-shapes [id] #(assoc % :name value)))))}
|
||||
(let [id (obj/get self "$id")
|
||||
value (when (string? value) (-> value str/trim cfh/clean-path))
|
||||
valid? (and (some? value)
|
||||
(not (str/ends-with? value "/"))
|
||||
(not (str/blank? value)))]
|
||||
(if valid?
|
||||
(st/emit! (dwsh/update-shapes [id] #(assoc % :name value)))
|
||||
(u/display-not-valid :shape-name value))))}
|
||||
|
||||
{:name "blocked"
|
||||
:get #(-> % u/proxy->shape :blocked boolean)
|
||||
|
|
Loading…
Add table
Reference in a new issue