diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index 939f9e26e..7c6cc2212 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -58,6 +58,10 @@ :command (ds/c-mod "shift+'") :fn #(st/emit! (dw/toggle-layout-flags :snap-grid))} + :toggle-snap-guide {:tooltip (ds/meta-shift "G") + :command (ds/c-mod "shift+G") + :fn #(st/emit! (dw/toggle-layout-flags :snap-guides))} + :toggle-alignment {:tooltip (ds/meta "\\") :command (ds/c-mod "\\") :fn #(st/emit! (dw/toggle-layout-flags :dynamic-alignment))} diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index 6a7c5aaab..f400f2f7b 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -194,7 +194,13 @@ (fn [_error] (st/emit! (dm/error (tr "errors.unexpected-error")))) (st/emitf dm/hide))))))) - on-item-click (fn [item] (fn [event] (do (dom/stop-propagation event) (reset! show-sub-menu? item))))] + + on-item-click + (mf/use-callback + (fn [item] + (fn [event] + (dom/stop-propagation event) + (reset! show-sub-menu? item))))] (mf/use-effect (mf/deps @editing?) @@ -314,12 +320,12 @@ [:& dropdown {:show (= @show-sub-menu? :preferences) :on-close #(reset! show-sub-menu? false)} [:ul.sub-menu.preferences - #_[:li {:on-click #()} - [:span - (if (contains? layout :snap-guide) - (tr "workspace.header.menu.disable-snap-guides") - (tr "workspace.header.menu.enable-snap-guides"))] - [:span.shortcut (sc/get-tooltip :toggle-snap-grid)]] + [:li {:on-click #(st/emit! (dw/toggle-layout-flags :snap-guides))} + [:span + (if (contains? layout :snap-guides) + (tr "workspace.header.menu.disable-snap-guides") + (tr "workspace.header.menu.enable-snap-guides"))] + [:span.shortcut (sc/get-tooltip :toggle-snap-guide)]] [:li {:on-click #(st/emit! (dw/toggle-layout-flags :snap-grid))} [:span