fix app crash if swiped block and editing block are different

This commit is contained in:
llcc
2022-06-05 14:25:28 +08:00
committed by Tienson Qin
parent 328fda29a9
commit 13cc487592
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
(ns frontend.handler.block
(:require
[clojure.set :as set]
[clojure.string :as string]
[clojure.walk :as walk]
[frontend.db :as db]
[frontend.db.model :as db-model]
@@ -149,8 +150,12 @@
(def *swipe (atom nil))
(defn on-touch-start
[event]
(let [input (state/get-input)]
[event uuid]
(let [input (state/get-input)
input-id (state/get-edit-input-id)]
(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-let [touches (.-targetTouches event)]