0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 04:19:08 -05:00

🐛 Fix missing create component menu for frames

This commit is contained in:
Pablo Alba 2022-12-28 12:53:37 +01:00 committed by Alejandro Alonso
parent c8bd1e89d6
commit dac11d1606
2 changed files with 13 additions and 14 deletions

View file

@ -32,6 +32,7 @@
- Fix problem when drawing boxes won't detect mouse-up [Taiga #4618](https://tree.taiga.io/project/penpot/issue/4618) - Fix problem when drawing boxes won't detect mouse-up [Taiga #4618](https://tree.taiga.io/project/penpot/issue/4618)
- Fix missing loading icon on shared libraries [Taiga #4148](https://tree.taiga.io/project/penpot/issue/4148) - Fix missing loading icon on shared libraries [Taiga #4148](https://tree.taiga.io/project/penpot/issue/4148)
- Fix selection stroke missing in properties of multiple texts [Taiga #4048](https://tree.taiga.io/project/penpot/issue/4048) - Fix selection stroke missing in properties of multiple texts [Taiga #4048](https://tree.taiga.io/project/penpot/issue/4048)
- Fix missing create component menu for frames [Github #2670](https://github.com/penpot/penpot/issues/2670)
### :arrow_up: Deps updates ### :arrow_up: Deps updates

View file

@ -398,7 +398,6 @@
[{:keys [shapes]}] [{:keys [shapes]}]
(let [single? (= (count shapes) 1) (let [single? (= (count shapes) 1)
has-frame? (->> shapes (d/seek cph/frame-shape?))
has-component? (some true? (map #(contains? % :component-id) shapes)) has-component? (some true? (map #(contains? % :component-id) shapes))
is-component? (and single? (-> shapes first :component-id some?)) is-component? (and single? (-> shapes first :component-id some?))
@ -454,19 +453,18 @@
:accept-style :primary :accept-style :primary
:on-accept do-update-component-in-bulk}))] :on-accept do-update-component-in-bulk}))]
[:* [:*
(when (not has-frame?) [:*
[:* [:& menu-separator]
[:& menu-separator] [:& menu-entry {:title (tr "workspace.shape.menu.create-component")
[:& menu-entry {:title (tr "workspace.shape.menu.create-component") :shortcut (sc/get-tooltip :create-component)
:shortcut (sc/get-tooltip :create-component) :on-click do-add-component}]
:on-click do-add-component}] (when (and has-component? (not single?))
(when (and has-component? (not single?)) [:*
[:* [:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk")
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk") :shortcut (sc/get-tooltip :detach-component)
:shortcut (sc/get-tooltip :detach-component) :on-click do-detach-component-in-bulk}]
:on-click do-detach-component-in-bulk}] [:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk")
[:& menu-entry {:title (tr "workspace.shape.menu.update-components-in-bulk") :on-click do-update-in-bulk}]])]
:on-click do-update-in-bulk}]])])
(when is-component? (when is-component?
;; WARNING: this menu is the same as the context menu at the sidebar. ;; WARNING: this menu is the same as the context menu at the sidebar.