mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 18:16:12 +02:00
✨ Fix corner cases of duplicate/copy-paste/cut-paste variants
This commit is contained in:
parent
39c7782019
commit
785b61be2f
15 changed files with 217 additions and 130 deletions
|
@ -2082,12 +2082,8 @@
|
|||
libraries (dsh/lookup-libraries state)
|
||||
ldata (dsh/lookup-file-data state file-id)
|
||||
|
||||
;; full-libs (assoc-in libraries [(:id ldata) :data] ldata)
|
||||
|
||||
full-libs libraries
|
||||
|
||||
[parent-id
|
||||
frame-id] (ctn/find-valid-parent-and-frame-ids candidate-parent-id page-objects (vals objects) true full-libs)
|
||||
frame-id] (ctn/find-valid-parent-and-frame-ids candidate-parent-id page-objects (vals objects) true libraries)
|
||||
|
||||
index (if (= candidate-parent-id parent-id)
|
||||
index
|
||||
|
@ -2101,7 +2097,6 @@
|
|||
|
||||
all-objects (merge page-objects objects)
|
||||
|
||||
|
||||
drop-cell (when (ctl/grid-layout? all-objects parent-id)
|
||||
(gslg/get-drop-cell frame-id all-objects position))
|
||||
|
||||
|
|
|
@ -344,7 +344,8 @@
|
|||
|
||||
(rx/of
|
||||
(add-new-variant main-instance-id)
|
||||
(dwu/commit-undo-transaction undo-id)))))))
|
||||
(dwu/commit-undo-transaction undo-id)
|
||||
(ptk/data-event :layout/update {:ids [variant-id]})))))))
|
||||
|
||||
(defn add-component-or-variant
|
||||
"Manage the shared shortcut, and do the pertinent action"
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
(let [open* (mf/use-state false)
|
||||
open (deref open*)
|
||||
|
||||
;;use-memo-equal
|
||||
selected* (mf/use-state default-selected)
|
||||
selected (deref selected*)
|
||||
|
||||
|
@ -215,6 +216,11 @@
|
|||
(mf/with-effect [options]
|
||||
(mf/set-ref-val! options-ref options))
|
||||
|
||||
(mf/use-effect
|
||||
(mf/deps default-selected)
|
||||
(fn []
|
||||
(reset! selected* default-selected)))
|
||||
|
||||
[:div {:ref combobox-ref
|
||||
:class (stl/css-case
|
||||
:combobox-wrapper true
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
do-cut #(st/emit! (dw/copy-selected)
|
||||
(dw/delete-selected))
|
||||
do-paste #(st/emit! (dw/paste-from-clipboard))
|
||||
do-duplicate #(st/emit! (dw/duplicate-selected true))
|
||||
do-duplicate #(st/emit! (dwv/duplicate-or-add-variant))
|
||||
|
||||
enabled-paste-props* (mf/use-state false)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
(ns app.main.ui.workspace.sidebar.options.shapes.frame
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
|
@ -72,7 +73,7 @@
|
|||
is-grid-layout? (ctl/grid-layout? shape)
|
||||
is-layout-child-absolute? (ctl/item-absolute? shape)
|
||||
variants? (features/use-feature "variants/v1")
|
||||
is-variant? (when variants? (:is-variant-container shape))]
|
||||
is-variant? (when variants? (ctk/is-variant-container? shape))]
|
||||
|
||||
[:*
|
||||
[:& layer-menu {:ids ids
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue