mirror of
https://github.com/penpot/penpot.git
synced 2025-07-28 23:57:21 +02:00
🐛 Remove numbers in layer creation
This commit is contained in:
parent
de7a1d34c0
commit
a1a3d09998
12 changed files with 228 additions and 239 deletions
|
@ -11,7 +11,6 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.path.shapes-to-path :as stp]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
|
@ -85,9 +84,7 @@
|
|||
(watch [it state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state)
|
||||
base-name (-> bool-type d/name str/capital (str "-1"))
|
||||
name (-> (ctt/retrieve-used-names objects)
|
||||
(ctt/generate-unique-name base-name))
|
||||
name (-> bool-type d/name str/capital)
|
||||
ids (selected-shapes-idx state)
|
||||
ordered-indexes (cph/order-by-indexed-shapes objects ids)
|
||||
shapes (->> ordered-indexes
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
[app.common.pages.helpers :as cph]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
|
@ -73,8 +72,7 @@
|
|||
(= (count shapes) 1)
|
||||
(= (:type (first shapes)) :group))
|
||||
(:name (first shapes))
|
||||
(-> (ctst/retrieve-used-names objects)
|
||||
(ctst/generate-unique-name base-name)))
|
||||
base-name)
|
||||
|
||||
selrect (gsh/selection-rect shapes)
|
||||
group-idx (->> shapes
|
||||
|
@ -162,7 +160,7 @@
|
|||
shapes (shapes-for-grouping objects selected)]
|
||||
(when-not (empty? shapes)
|
||||
(let [[group changes]
|
||||
(prepare-create-group it objects page-id shapes "Group-1" false)]
|
||||
(prepare-create-group it objects page-id shapes "Group" false)]
|
||||
(rx/of (dch/commit-changes changes)
|
||||
(dws/select-shapes (d/ordered-set (:id group))))))))))
|
||||
|
||||
|
@ -221,7 +219,7 @@
|
|||
(= (:type (first shapes)) :group))
|
||||
[first-shape (-> (pcb/empty-changes it page-id)
|
||||
(pcb/with-objects objects))]
|
||||
(prepare-create-group it objects page-id shapes "Group-1" true))
|
||||
(prepare-create-group it objects page-id shapes "Mask" true))
|
||||
|
||||
changes (-> changes
|
||||
(pcb/update-shapes (:shapes group)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
[app.common.types.file :as ctf]
|
||||
[app.common.types.file.media-object :as ctfm]
|
||||
[app.common.types.pages-list :as ctpl]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.types.typography :as ctt]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.dashboard :as dd]
|
||||
|
@ -373,9 +372,7 @@
|
|||
(watch [it state _]
|
||||
(let [libraries (wsh/get-libraries state)
|
||||
component (cph/get-component libraries id)
|
||||
all-components (-> state :workspace-data :components vals)
|
||||
unames (into #{} (map :name) all-components)
|
||||
new-name (ctst/generate-unique-name unames (:name component))
|
||||
new-name (:name component)
|
||||
|
||||
components-v2 (features/active-feature? state :components-v2)
|
||||
|
||||
|
|
|
@ -327,8 +327,7 @@
|
|||
(defn- prepare-duplicate-frame-change
|
||||
[changes objects page unames update-unames! ids-map obj delta]
|
||||
(let [new-id (ids-map (:id obj))
|
||||
frame-name (ctt/generate-unique-name @unames (:name obj))
|
||||
_ (update-unames! frame-name)
|
||||
frame-name (:name obj)
|
||||
|
||||
new-frame (-> obj
|
||||
(assoc :id new-id
|
||||
|
@ -361,8 +360,7 @@
|
|||
(if (some? obj)
|
||||
(let [new-id (ids-map (:id obj))
|
||||
parent-id (or parent-id frame-id)
|
||||
name (ctt/generate-unique-name @unames (:name obj))
|
||||
_ (update-unames! name)
|
||||
name (:name obj)
|
||||
|
||||
new-obj (-> obj
|
||||
(assoc :id new-id
|
||||
|
|
|
@ -87,9 +87,7 @@
|
|||
selected (wsh/lookup-selected state)
|
||||
|
||||
id (or (:id attrs) (uuid/next))
|
||||
name (-> objects
|
||||
(ctst/retrieve-used-names)
|
||||
(ctst/generate-unique-name (:name attrs)))
|
||||
name (:name attrs)
|
||||
|
||||
shape (make-new-shape
|
||||
(assoc attrs :id id :name name)
|
||||
|
|
|
@ -362,7 +362,7 @@
|
|||
(let [{:keys [tag attrs hidden]} element-data
|
||||
attrs (usvg/format-styles attrs)
|
||||
element-data (cond-> element-data (map? element-data) (assoc :attrs attrs))
|
||||
name (ctst/generate-unique-name unames (or (:id attrs) (tag->name tag)))
|
||||
name (or (:id attrs) (tag->name tag))
|
||||
att-refs (usvg/find-attr-references attrs)
|
||||
references (usvg/find-def-references (:defs svg-data) att-refs)
|
||||
|
||||
|
@ -492,8 +492,7 @@
|
|||
|
||||
unames (ctst/retrieve-used-names objects)
|
||||
|
||||
svg-name (->> (str/replace (:name svg-data) ".svg" "")
|
||||
(ctst/generate-unique-name unames))
|
||||
svg-name (str/replace (:name svg-data) ".svg" "")
|
||||
|
||||
svg-data (-> svg-data
|
||||
(assoc :x x
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue