mirror of https://github.com/logseq/logseq
resolve conflicts between select and swipe on non-editing mode
Also, fix issue that it is hard to move caret on editing modepull/5557/head^2
parent
13cc487592
commit
cd6e2ca051
|
@ -148,16 +148,18 @@
|
|||
(state/exit-editing-and-set-selected-blocks! blocks))))
|
||||
|
||||
(def *swipe (atom nil))
|
||||
(def *touch-start (atom nil))
|
||||
|
||||
(defn on-touch-start
|
||||
[event uuid]
|
||||
(let [input (state/get-input)
|
||||
input-id (state/get-edit-input-id)]
|
||||
input-id (state/get-edit-input-id)
|
||||
selection-type (.-type (.getSelection js/document))]
|
||||
(reset! *touch-start (js/Date.now))
|
||||
(when-not (and input
|
||||
(string/ends-with? input-id (str uuid)))
|
||||
(state/clear-edit!))
|
||||
(when (= (util/get-selection-start input)
|
||||
(util/get-selection-end input))
|
||||
(when (not= selection-type "Range")
|
||||
(when-let [touches (.-targetTouches event)]
|
||||
(when (= (.-length touches) 1)
|
||||
(let [touch (aget touches 0)
|
||||
|
@ -168,6 +170,9 @@
|
|||
(defn on-touch-move
|
||||
[event block uuid edit? *show-left-menu? *show-right-menu?]
|
||||
(when-let [touches (.-targetTouches event)]
|
||||
(let [selection-type (.-type (.getSelection js/document))]
|
||||
(when-not (= selection-type "Range")
|
||||
(when (< (- (js/Date.now) @*touch-start) 600)
|
||||
(when (and (= (.-length touches) 1) @*swipe)
|
||||
(let [{:keys [x0 xi direction]} @*swipe
|
||||
touch (aget touches 0)
|
||||
|
@ -235,7 +240,7 @@
|
|||
(set! (.. more -style -opacity) "100%")
|
||||
(set! (.. more -style -opacity) "30%"))))))
|
||||
:else
|
||||
nil))))))))
|
||||
nil)))))))))))
|
||||
|
||||
(defn on-touch-end
|
||||
[_event block uuid *show-left-menu? *show-right-menu?]
|
||||
|
|
Loading…
Reference in New Issue