mirror of https://github.com/logseq/logseq
fix(editor): exit editing mode and clear highlights when blocks are selected
parent
b5c454648d
commit
41c9bf0fd0
|
@ -1138,6 +1138,12 @@
|
||||||
(dom/remove-class! block "noselect"))
|
(dom/remove-class! block "noselect"))
|
||||||
(state/clear-selection-blocks!)))
|
(state/clear-selection-blocks!)))
|
||||||
|
|
||||||
|
(defn exit-editing-and-set-selected-blocks!
|
||||||
|
[blocks]
|
||||||
|
(util/clear-selection!)
|
||||||
|
(state/clear-edit!)
|
||||||
|
(state/set-selection-blocks! blocks))
|
||||||
|
|
||||||
(defn select-all-blocks!
|
(defn select-all-blocks!
|
||||||
[]
|
[]
|
||||||
(when-let [current-input-id (state/get-edit-input-id)]
|
(when-let [current-input-id (state/get-edit-input-id)]
|
||||||
|
@ -1146,7 +1152,7 @@
|
||||||
blocks (dom/by-class blocks-container "ls-block")]
|
blocks (dom/by-class blocks-container "ls-block")]
|
||||||
(doseq [block blocks]
|
(doseq [block blocks]
|
||||||
(dom/add-class! block "selected noselect"))
|
(dom/add-class! block "selected noselect"))
|
||||||
(state/set-selection-blocks! blocks))))
|
(exit-editing-and-set-selected-blocks! blocks))))
|
||||||
|
|
||||||
(defn- get-selected-blocks-with-children
|
(defn- get-selected-blocks-with-children
|
||||||
[]
|
[]
|
||||||
|
@ -1295,7 +1301,7 @@
|
||||||
(let [blocks (util/get-nodes-between-two-nodes start-block end-block "ls-block")]
|
(let [blocks (util/get-nodes-between-two-nodes start-block end-block "ls-block")]
|
||||||
(doseq [block blocks]
|
(doseq [block blocks]
|
||||||
(dom/add-class! block "selected noselect"))
|
(dom/add-class! block "selected noselect"))
|
||||||
(state/set-selection-blocks! blocks))))
|
(exit-editing-and-set-selected-blocks! blocks))))
|
||||||
|
|
||||||
(defn on-select-block
|
(defn on-select-block
|
||||||
[state e up?]
|
[state e up?]
|
||||||
|
@ -1330,6 +1336,7 @@
|
||||||
nil)
|
nil)
|
||||||
(do
|
(do
|
||||||
(util/clear-selection!)
|
(util/clear-selection!)
|
||||||
|
(state/clear-edit!)
|
||||||
(state/conj-selection-block! element up?))))))))
|
(state/conj-selection-block! element up?))))))))
|
||||||
|
|
||||||
(defn save-block-aux!
|
(defn save-block-aux!
|
||||||
|
|
Loading…
Reference in New Issue