fix(iOS): empty block can't be backspace deleted

close https://github.com/logseq/logseq/issues/3648
This commit is contained in:
leizhe
2022-01-12 22:50:07 +08:00
committed by Tienson Qin
parent d254b3acbe
commit cbc44dee1b

View File

@@ -56,7 +56,8 @@
[lambdaisland.glogi :as log]
[medley.core :as medley]
[promesa.core :as p]
[frontend.util.keycode :as keycode]))
[frontend.util.keycode :as keycode]
[frontend.mobile.util :as mobile-util]))
;; FIXME: should support multiple images concurrently uploading
@@ -2956,6 +2957,16 @@
(or ctrlKey metaKey)
nil
;; FIXME: On iOS, a backspace click to call keydown-backspace-handler
;; does not work sometimes in an empty block, hence the empty block
;; can't be deleted. Need to figure out why and find a better solution.
(and (mobile-util/native-ios?)
(= key "Backspace")
(= value ""))
(do
(util/stop e)
(delete-block! (state/get-current-repo) false))
(and (= key "#")
(and
(> pos 0)