mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 12:59:12 -05:00
commit
c2b752e560
6 changed files with 38 additions and 9 deletions
|
@ -345,7 +345,9 @@
|
||||||
update-new-shape
|
update-new-shape
|
||||||
(fn [object _] object)
|
(fn [object _] object)
|
||||||
force-id
|
force-id
|
||||||
keep-ids?)
|
keep-ids?
|
||||||
|
frame-id)
|
||||||
|
|
||||||
|
|
||||||
;; Fix empty parent-id and remap all grid cells to the new ids.
|
;; Fix empty parent-id and remap all grid cells to the new ids.
|
||||||
remap-ids
|
remap-ids
|
||||||
|
|
|
@ -227,12 +227,23 @@
|
||||||
|
|
||||||
([changes library-data component-id it page delta old-id parent-id]
|
([changes library-data component-id it page delta old-id parent-id]
|
||||||
(let [component (ctkl/get-deleted-component library-data component-id)
|
(let [component (ctkl/get-deleted-component library-data component-id)
|
||||||
|
parent (get-in page [:objects parent-id])
|
||||||
|
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
||||||
|
|
||||||
shapes (cfh/get-children-with-self (:objects component) (:main-instance-id component))
|
shapes (cfh/get-children-with-self (:objects component) (:main-instance-id component))
|
||||||
shapes (map #(gsh/move % delta) shapes)
|
shapes (map #(gsh/move % delta) shapes)
|
||||||
first-shape (cond-> (first shapes)
|
first-shape (cond-> (first shapes)
|
||||||
(not (nil? parent-id))
|
(not (nil? parent-id))
|
||||||
(assoc :parent-id parent-id))
|
(assoc :parent-id parent-id)
|
||||||
|
(and parent (= :frame (:type parent)))
|
||||||
|
(assoc :frame-id parent-id)
|
||||||
|
(and parent (not= :frame (:type parent)))
|
||||||
|
(assoc :frame-id (:frame-id parent))
|
||||||
|
inside-component?
|
||||||
|
(dissoc :component-root)
|
||||||
|
(not inside-component?)
|
||||||
|
(assoc :component-root true))
|
||||||
|
|
||||||
changes (-> (or changes (pcb/empty-changes it))
|
changes (-> (or changes (pcb/empty-changes it))
|
||||||
(pcb/with-page page)
|
(pcb/with-page page)
|
||||||
(pcb/with-objects (:objects page))
|
(pcb/with-objects (:objects page))
|
||||||
|
|
|
@ -201,6 +201,7 @@
|
||||||
workspace-libraries (mf/deref refs/workspace-libraries)
|
workspace-libraries (mf/deref refs/workspace-libraries)
|
||||||
objects (mf/deref refs/workspace-page-objects)
|
objects (mf/deref refs/workspace-page-objects)
|
||||||
libraries (assoc workspace-libraries current-file-id (assoc workspace-file :data workspace-data))
|
libraries (assoc workspace-libraries current-file-id (assoc workspace-file :data workspace-data))
|
||||||
|
single-comp (ctf/get-component libraries (:component-file shape) (:component-id shape))
|
||||||
every-same-file? (every? #(= (:component-file shape) (:component-file %)) shapes)
|
every-same-file? (every? #(= (:component-file shape) (:component-file %)) shapes)
|
||||||
current-comp-id (when (every? #(= (:component-id shape) (:component-id %)) shapes)
|
current-comp-id (when (every? #(= (:component-id shape) (:component-id %)) shapes)
|
||||||
(:component-id shape))
|
(:component-id shape))
|
||||||
|
@ -208,10 +209,10 @@
|
||||||
file-id (if every-same-file?
|
file-id (if every-same-file?
|
||||||
(:component-file shape)
|
(:component-file shape)
|
||||||
current-file-id)
|
current-file-id)
|
||||||
paths (->> shapes
|
orig-components (map #(ctf/get-component libraries (:component-file %) (:component-id %)) shapes)
|
||||||
(map :name)
|
paths (->> orig-components
|
||||||
(map cfh/split-path)
|
(map :path)
|
||||||
(map butlast))
|
(map cfh/split-path))
|
||||||
|
|
||||||
find-common-path (fn common-path [path n]
|
find-common-path (fn common-path [path n]
|
||||||
(let [current (nth (first paths) n nil)]
|
(let [current (nth (first paths) n nil)]
|
||||||
|
@ -221,7 +222,7 @@
|
||||||
(common-path (conj path current) (inc n)))))
|
(common-path (conj path current) (inc n)))))
|
||||||
|
|
||||||
path (if single?
|
path (if single?
|
||||||
(cfh/butlast-path (:name shape))
|
(:path single-comp)
|
||||||
(cfh/join-path (if (not every-same-file?)
|
(cfh/join-path (if (not every-same-file?)
|
||||||
""
|
""
|
||||||
(find-common-path [] 0))))
|
(find-common-path [] 0))))
|
||||||
|
@ -359,6 +360,10 @@
|
||||||
[:span i/arrow-slide]
|
[:span i/arrow-slide]
|
||||||
[:span (:path filters)]])
|
[:span (:path filters)]])
|
||||||
|
|
||||||
|
(when (empty? items)
|
||||||
|
[:div {:class (stl/css :component-list-empty)}
|
||||||
|
(tr "workspace.options.component.swap.empty")])
|
||||||
|
|
||||||
(when (:listing-thumbs? filters)
|
(when (:listing-thumbs? filters)
|
||||||
[:div {:class (stl/css :component-list)}
|
[:div {:class (stl/css :component-list)}
|
||||||
(for [item groups]
|
(for [item groups]
|
||||||
|
|
|
@ -216,6 +216,11 @@
|
||||||
height: $s-16;
|
height: $s-16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.component-list-empty {
|
||||||
|
@include titleTipography;
|
||||||
|
margin: 0 $s-4 0 $s-8;
|
||||||
|
}
|
||||||
|
|
||||||
.component-list {
|
.component-list {
|
||||||
margin: 0 $s-4 0 $s-8;
|
margin: 0 $s-4 0 $s-8;
|
||||||
.component-item {
|
.component-item {
|
||||||
|
|
|
@ -3641,9 +3641,12 @@ msgstr "Edit an annotation"
|
||||||
msgid "workspace.options.component.main"
|
msgid "workspace.options.component.main"
|
||||||
msgstr "Main"
|
msgstr "Main"
|
||||||
|
|
||||||
|
|
||||||
msgid "workspace.options.component.swap"
|
msgid "workspace.options.component.swap"
|
||||||
msgstr "Swap component"
|
msgstr "Swap component"
|
||||||
|
|
||||||
|
msgid "workspace.options.component.swap.empty"
|
||||||
|
msgstr "There are no assets in this library yet"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
|
#: src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
|
||||||
msgid "workspace.options.constraints"
|
msgid "workspace.options.constraints"
|
||||||
msgstr "Constraints"
|
msgstr "Constraints"
|
||||||
|
|
|
@ -3706,9 +3706,12 @@ msgstr "Editar una nota"
|
||||||
msgid "workspace.options.component.main"
|
msgid "workspace.options.component.main"
|
||||||
msgstr "Principal"
|
msgstr "Principal"
|
||||||
|
|
||||||
|
|
||||||
msgid "workspace.options.component.swap"
|
msgid "workspace.options.component.swap"
|
||||||
msgstr "Intercambiar componente"
|
msgstr "Intercambiar componente"
|
||||||
|
|
||||||
|
msgid "workspace.options.component.swap.empty"
|
||||||
|
msgstr "Aún no hay recursos en esta biblioteca"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
|
#: src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
|
||||||
msgid "workspace.options.constraints"
|
msgid "workspace.options.constraints"
|
||||||
msgstr "Restricciones"
|
msgstr "Restricciones"
|
||||||
|
|
Loading…
Add table
Reference in a new issue