0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🐛 Disallow to create a redundant component

This commit is contained in:
Andrés Moya 2021-11-05 16:33:35 +01:00 committed by Andrés Moya
parent 7c3d71e572
commit 50d756b189
3 changed files with 59 additions and 54 deletions

View file

@ -11,11 +11,12 @@
### :bug: Bugs fixed
- Fix problem with exporting before the document is saved [Taiga #2189](https://tree.taiga.io/project/penpot/issue/2189)
- Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191)
- Fix pages dropdown in viewer [Taiga #2087](https://tree.taiga.io/project/penpot/issue/2087)
- Fix problem when exporting texts with gradients or opacity [Taiga #2200](https://tree.taiga.io/project/penpot/issue/2200)
- Fix problem with view mode comments [Taiga #](https://tree.taiga.io/project/penpot/issue/2226)
- Fix problem with exporting before the document is saved [Taiga #2189](https://tree.taiga.io/project/penpot/issue/2189).
- Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191).
- Fix pages dropdown in viewer [Taiga #2087](https://tree.taiga.io/project/penpot/issue/2087).
- Fix problem when exporting texts with gradients or opacity [Taiga #2200](https://tree.taiga.io/project/penpot/issue/2200).
- Fix problem with view mode comments [Taiga #226](https://tree.taiga.io/project/penpot/issue/2226).
- Disallow to create a component when already has one [Taiga #2237](https://tree.taiga.io/project/penpot/issue/2237).
### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!)

View file

@ -125,6 +125,9 @@
create a group that contains all ids. Then, make a component with it,
and link all shapes to their corresponding one in the component."
[shapes objects page-id file-id]
(if (and (= (count shapes) 1)
(:component-id (first shapes)))
empty-changes
(let [[group rchanges uchanges]
(if (and (= (count shapes) 1)
(= (:type (first shapes)) :group))
@ -188,7 +191,7 @@
:attr :touched
:val (:touched original-shape)}]}))
updated-shapes))]
[group rchanges uchanges]))
[group rchanges uchanges])))
(defn duplicate-component
"Clone the root shape of the component and all children. Generate new

View file

@ -281,7 +281,8 @@
[:& menu-entry {:title (tr "workspace.shape.menu.delete-flow-start")
:on-click (do-remove-flow flow)}])))
(when (not= (:type shape) :frame)
(when (and (not= (:type shape) :frame)
(or multiple? (nil? (:component-id shape))))
[:*
[:& menu-separator]
[:& menu-entry {:title (tr "workspace.shape.menu.create-component")