mirror of https://github.com/logseq/logseq
fix: refresh root ui after undo or redo
parent
bc034768c1
commit
9789996e8c
|
@ -150,8 +150,6 @@
|
||||||
re-render-root? false
|
re-render-root? false
|
||||||
add-history? true
|
add-history? true
|
||||||
update-status? false}}]
|
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)
|
(let [edit-block (state/get-edit-block)
|
||||||
original-content (db/get-file-no-sub repo path)]
|
original-content (db/get-file-no-sub repo path)]
|
||||||
(if reset?
|
(if reset?
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
[frontend.history :as history]
|
[frontend.history :as history]
|
||||||
[frontend.handler.file :as file]
|
[frontend.handler.file :as file]
|
||||||
[frontend.handler.editor :as editor]
|
[frontend.handler.editor :as editor]
|
||||||
|
[frontend.handler.ui :as ui-handler]
|
||||||
[promesa.core :as p]
|
[promesa.core :as p]
|
||||||
[clojure.core.async :as async]
|
[clojure.core.async :as async]
|
||||||
[goog.dom :as gdom]
|
[goog.dom :as gdom]
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
|
|
||||||
(defn restore-cursor!
|
(defn restore-cursor!
|
||||||
[{:keys [block-container block-idx pos] :as state}]
|
[{:keys [block-container block-idx pos] :as state}]
|
||||||
|
(ui-handler/re-render-root!)
|
||||||
;; get the element
|
;; get the element
|
||||||
(when (and block-container block-idx pos)
|
(when (and block-container block-idx pos)
|
||||||
(when-let [container (gdom/getElement block-container)]
|
(when-let [container (gdom/getElement block-container)]
|
||||||
|
|
|
@ -87,7 +87,6 @@
|
||||||
;; restore cursor
|
;; restore cursor
|
||||||
(when (> idx' 0)
|
(when (> idx' 0)
|
||||||
(let [prev-tx (get-in @history [repo (dec idx')])]
|
(let [prev-tx (get-in @history [repo (dec idx')])]
|
||||||
(prn {:prev-tx prev-tx})
|
|
||||||
(when restore-cursor (restore-cursor prev-tx)))))))))))
|
(when restore-cursor (restore-cursor prev-tx)))))))))))
|
||||||
|
|
||||||
(defonce *redoing? (atom false))
|
(defonce *redoing? (atom false))
|
||||||
|
@ -108,6 +107,7 @@
|
||||||
:re-render-root? true})))]
|
:re-render-root? true})))]
|
||||||
(-> (p/all promises)
|
(-> (p/all promises)
|
||||||
(p/then (fn []
|
(p/then (fn []
|
||||||
|
(db/clear-query-state!)
|
||||||
(swap! history-idx assoc repo (inc idx))
|
(swap! history-idx assoc repo (inc idx))
|
||||||
(reset! *redoing? false)
|
(reset! *redoing? false)
|
||||||
;; restore cursor
|
;; restore cursor
|
||||||
|
|
Loading…
Reference in New Issue