feat: add a shortcut for escape editing

This commit is contained in:
Weihua Lu
2021-06-17 12:50:39 +08:00
committed by Tienson Qin
parent 6535e2068d
commit a7543a2a18
5 changed files with 22 additions and 8 deletions

View File

@@ -3015,3 +3015,13 @@
(->> (all-blocks-with-level {:collapse? true})
(map (comp gdom/getElementByClass str :block/uuid))
state/exit-editing-and-set-selected-blocks!)))
(defn escape-editing
([]
(escape-editing true))
([select?]
(when (state/editing?)
(if select?
(->> (:block/uuid (state/get-edit-block))
select-block!)
(state/clear-edit!)))))