mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 15:39:50 -05:00
commit
c2b752e560
6 changed files with 38 additions and 9 deletions
|
@ -345,7 +345,9 @@
|
|||
update-new-shape
|
||||
(fn [object _] object)
|
||||
force-id
|
||||
keep-ids?)
|
||||
keep-ids?
|
||||
frame-id)
|
||||
|
||||
|
||||
;; Fix empty parent-id and remap all grid cells to the new ids.
|
||||
remap-ids
|
||||
|
|
|
@ -227,12 +227,23 @@
|
|||
|
||||
([changes library-data component-id it page delta old-id parent-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 (map #(gsh/move % delta) shapes)
|
||||
first-shape (cond-> (first shapes)
|
||||
(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))
|
||||
(pcb/with-page page)
|
||||
(pcb/with-objects (:objects page))
|
||||
|
|
|
@ -201,6 +201,7 @@
|
|||
workspace-libraries (mf/deref refs/workspace-libraries)
|
||||
objects (mf/deref refs/workspace-page-objects)
|
||||
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)
|
||||
current-comp-id (when (every? #(= (:component-id shape) (:component-id %)) shapes)
|
||||
(:component-id shape))
|
||||
|
@ -208,10 +209,10 @@
|
|||
file-id (if every-same-file?
|
||||
(:component-file shape)
|
||||
current-file-id)
|
||||
paths (->> shapes
|
||||
(map :name)
|
||||
(map cfh/split-path)
|
||||
(map butlast))
|
||||
orig-components (map #(ctf/get-component libraries (:component-file %) (:component-id %)) shapes)
|
||||
paths (->> orig-components
|
||||
(map :path)
|
||||
(map cfh/split-path))
|
||||
|
||||
find-common-path (fn common-path [path n]
|
||||
(let [current (nth (first paths) n nil)]
|
||||
|
@ -221,7 +222,7 @@
|
|||
(common-path (conj path current) (inc n)))))
|
||||
|
||||
path (if single?
|
||||
(cfh/butlast-path (:name shape))
|
||||
(:path single-comp)
|
||||
(cfh/join-path (if (not every-same-file?)
|
||||
""
|
||||
(find-common-path [] 0))))
|
||||
|
@ -359,6 +360,10 @@
|
|||
[:span i/arrow-slide]
|
||||
[:span (:path filters)]])
|
||||
|
||||
(when (empty? items)
|
||||
[:div {:class (stl/css :component-list-empty)}
|
||||
(tr "workspace.options.component.swap.empty")])
|
||||
|
||||
(when (:listing-thumbs? filters)
|
||||
[:div {:class (stl/css :component-list)}
|
||||
(for [item groups]
|
||||
|
|
|
@ -216,6 +216,11 @@
|
|||
height: $s-16;
|
||||
}
|
||||
|
||||
.component-list-empty {
|
||||
@include titleTipography;
|
||||
margin: 0 $s-4 0 $s-8;
|
||||
}
|
||||
|
||||
.component-list {
|
||||
margin: 0 $s-4 0 $s-8;
|
||||
.component-item {
|
||||
|
|
|
@ -3641,9 +3641,12 @@ msgstr "Edit an annotation"
|
|||
msgid "workspace.options.component.main"
|
||||
msgstr "Main"
|
||||
|
||||
|
||||
msgid "workspace.options.component.swap"
|
||||
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
|
||||
msgid "workspace.options.constraints"
|
||||
msgstr "Constraints"
|
||||
|
|
|
@ -3706,9 +3706,12 @@ msgstr "Editar una nota"
|
|||
msgid "workspace.options.component.main"
|
||||
msgstr "Principal"
|
||||
|
||||
|
||||
msgid "workspace.options.component.swap"
|
||||
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
|
||||
msgid "workspace.options.constraints"
|
||||
msgstr "Restricciones"
|
||||
|
|
Loading…
Add table
Reference in a new issue