0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

🐛 Add missing option for delete grid layout on context-menu

This commit is contained in:
Andrey Antukh 2024-02-29 11:04:20 +01:00 committed by Alonso Torres
parent 7d2af587cd
commit 0b20d85677
3 changed files with 23 additions and 9 deletions

View file

@ -391,12 +391,13 @@
(mf/defc context-menu-layout
{::mf/props :obj}
[{:keys [shapes]}]
(let [single? (= (count shapes) 1)
(let [single? (= (count shapes) 1)
^boolean
is-flex? (and single?
(some cfh/frame-shape? shapes)
(= :flex (:layout (first shapes))))
has-flex?
(and single? (every? ctl/flex-layout? shapes))
has-grid?
(and single? (every? ctl/grid-layout? shapes))
on-add-layout
(mf/use-fn
@ -414,12 +415,17 @@
(let [ids (map :id shapes)]
(st/emit! (dwsl/remove-layout ids)))))]
(if is-flex?
(if (or ^boolean has-flex?
^boolean has-grid?)
[:div
[:& menu-separator]
[:& menu-entry {:title (tr "workspace.shape.menu.remove-flex")
:shortcut (sc/get-tooltip :toggle-layout-flex)
:on-click on-remove-layout}]]
(if has-flex?
[:& menu-entry {:title (tr "workspace.shape.menu.remove-flex")
:shortcut (sc/get-tooltip :toggle-layout-flex)
:on-click on-remove-layout}]
[:& menu-entry {:title (tr "workspace.shape.menu.remove-grid")
:shortcut (sc/get-tooltip :toggle-layout-grid)
:on-click on-remove-layout}])]
[:div
[:& menu-separator]

View file

@ -4761,6 +4761,10 @@ msgstr "Path"
msgid "workspace.shape.menu.remove-flex"
msgstr "Remove flex layout"
#: src/app/main/ui/workspace/context_menu.cljs
msgid "workspace.shape.menu.remove-grid"
msgstr "Remove grid layout"
#: src/app/main/ui/workspace/sidebar/options/menus/component.cljs, src/app/main/ui/workspace/sidebar/options/menus/component.cljs, src/app/main/ui/workspace/context_menu.cljs, src/app/main/ui/workspace/context_menu.cljs
msgid "workspace.shape.menu.reset-overrides"
msgstr "Reset overrides"

View file

@ -4837,6 +4837,10 @@ msgstr "Ruta"
msgid "workspace.shape.menu.remove-flex"
msgstr "Eliminar flex layout"
#: src/app/main/ui/workspace/context_menu.cljs
msgid "workspace.shape.menu.remove-grid"
msgstr "Eliminar grid layout"
#: src/app/main/ui/workspace/sidebar/options/menus/component.cljs,
#: src/app/main/ui/workspace/context_menu.cljs,
#: src/app/main/ui/workspace/context_menu.cljs