fix: CTRL+X is deleting the last character when nothing is selected

fix #5821
This commit is contained in:
Tienson Qin
2022-07-07 01:04:49 +08:00
parent f9c025542e
commit 290c2b5b83
2 changed files with 12 additions and 3 deletions

View File

@@ -2957,14 +2957,18 @@
"shortcut cut action:
* when in selection mode, cut selected blocks
* when in edit mode with text selected, cut selected text
* otherwise same as delete shortcut"
* otherwise nothing need to be handled."
[e]
(cond
(state/selection?)
(shortcut-cut-selection e)
(state/editing?)
(keydown-backspace-handler true e)))
(and (state/editing?) (util/input-text-selected?
(gdom/getElement (state/get-edit-input-id))))
(keydown-backspace-handler true e)
:else
nil))
(defn delete-selection
[e]