0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49: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

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

View file

@ -4761,6 +4761,10 @@ msgstr "Path"
msgid "workspace.shape.menu.remove-flex" msgid "workspace.shape.menu.remove-flex"
msgstr "Remove flex layout" 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 #: 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" msgid "workspace.shape.menu.reset-overrides"
msgstr "Reset overrides" msgstr "Reset overrides"

View file

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