mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 08:46:11 +02:00
🐛 Fix double click crash on viewer layers
This commit is contained in:
parent
95829ff3de
commit
ac1167d0c9
3 changed files with 12 additions and 4 deletions
|
@ -72,7 +72,7 @@
|
|||
:icon-layer (= (:type item) :icon))
|
||||
:on-click select-shape}
|
||||
[:& si/element-icon {:shape item}]
|
||||
[:& layer-name {:shape item}]
|
||||
[:& layer-name {:shape item :disabled-double-click true}]
|
||||
|
||||
(when (and (not disable-collapse?) (:shapes item))
|
||||
[:span.toggle-content
|
||||
|
|
|
@ -32,13 +32,14 @@
|
|||
(l/derived (l/in [:workspace-local :shape-for-rename]) st/state))
|
||||
|
||||
(mf/defc layer-name
|
||||
[{:keys [shape on-start-edit on-stop-edit name-ref] :as props}]
|
||||
[{:keys [shape on-start-edit disabled-double-click on-stop-edit name-ref] :as props}]
|
||||
(let [local (mf/use-state {})
|
||||
shape-for-rename (mf/deref shape-for-rename-ref)
|
||||
|
||||
start-edit (fn []
|
||||
(on-start-edit)
|
||||
(swap! local assoc :edition true))
|
||||
(when (not disabled-double-click)
|
||||
(on-start-edit)
|
||||
(swap! local assoc :edition true)))
|
||||
|
||||
accept-edit (fn []
|
||||
(let [name-input (mf/ref-val name-ref)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue