0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

Merge pull request #4387 from penpot/superalex-fix-cmd-option-enter-when-popups-blocked

🐛 Fix cmd+option+enter when popups blocked
This commit is contained in:
Aitor Moreno 2024-04-10 12:19:59 +02:00 committed by GitHub
commit 420178e620
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View file

@ -98,7 +98,8 @@
closed-preview (rx/subject)
preview (.open js/window "/#/frame-preview")
listener-fn #(rx/push! closed-preview true)]
(.addEventListener preview "beforeunload" listener-fn)
(when (some? preview)
(.addEventListener preview "beforeunload" listener-fn))
(->> (rx/from-atom (refs/all-children-objects shape-id) {:emit-current-value? true})
(rx/take-until closed-preview)
(rx/debounce 1000)

View file

@ -547,11 +547,6 @@
:subsections [:shape]
:fn #(emit-when-no-readonly (dw/create-bool :exclude))}
;; PREVIEW
:preview-frame {:tooltip (ds/meta (ds/alt ds/enter))
:command (ds/c-mod "alt+enter")
:fn #(emit-when-no-readonly (dp/open-preview-selected))}
;; THEME
:toggle-theme {:tooltip (ds/alt "M")
:command (ds/a-mod "m")
@ -559,6 +554,12 @@
:fn #(st/emit! (with-meta (du/toggle-theme)
{::ev/origin "workspace:shortcut"}))}})
(def debug-shortcuts
;; PREVIEW
{:preview-frame {:tooltip (ds/meta (ds/alt ds/enter))
:command (ds/c-mod "alt+enter")
:fn #(emit-when-no-readonly (dp/open-preview-selected))}})
(def opacity-shortcuts
(into {} (->>
(range 10)
@ -569,7 +570,9 @@
:fn #(emit-when-no-readonly (dwly/pressed-opacity n))}])))))
(def shortcuts
(merge base-shortcuts opacity-shortcuts dwtxts/shortcuts))
(cond-> (merge base-shortcuts opacity-shortcuts dwtxts/shortcuts)
*assert*
(merge debug-shortcuts)))
(defn get-tooltip [shortcut]
(assert (contains? shortcuts shortcut) (str shortcut))