fix: refresh root ui after undo or redo

pull/1072/head
Tienson Qin 2021-01-12 12:24:00 +08:00
parent bc034768c1
commit 9789996e8c
3 changed files with 3 additions and 3 deletions

View File

@ -150,8 +150,6 @@
re-render-root? false
add-history? true
update-status? false}}]
(prn "alter file:" {:editor/pos (state/get-edit-pos)
:editor/block (state/get-edit-block)})
(let [edit-block (state/get-edit-block)
original-content (db/get-file-no-sub repo path)]
(if reset?

View File

@ -4,6 +4,7 @@
[frontend.history :as history]
[frontend.handler.file :as file]
[frontend.handler.editor :as editor]
[frontend.handler.ui :as ui-handler]
[promesa.core :as p]
[clojure.core.async :as async]
[goog.dom :as gdom]
@ -22,6 +23,7 @@
(defn restore-cursor!
[{:keys [block-container block-idx pos] :as state}]
(ui-handler/re-render-root!)
;; get the element
(when (and block-container block-idx pos)
(when-let [container (gdom/getElement block-container)]

View File

@ -87,7 +87,6 @@
;; restore cursor
(when (> idx' 0)
(let [prev-tx (get-in @history [repo (dec idx')])]
(prn {:prev-tx prev-tx})
(when restore-cursor (restore-cursor prev-tx)))))))))))
(defonce *redoing? (atom false))
@ -108,6 +107,7 @@
:re-render-root? true})))]
(-> (p/all promises)
(p/then (fn []
(db/clear-query-state!)
(swap! history-idx assoc repo (inc idx))
(reset! *redoing? false)
;; restore cursor