mirror of https://github.com/logseq/logseq
parent
1541b3b47a
commit
7824973abc
|
@ -743,8 +743,12 @@
|
||||||
(assoc properties new-marker (util/time-ms))
|
(assoc properties new-marker (util/time-ms))
|
||||||
properties)))
|
properties)))
|
||||||
|
|
||||||
|
;; FIXME: temporal fix
|
||||||
|
(defonce *skip-save-block? (atom false))
|
||||||
|
|
||||||
(defn insert-new-block!
|
(defn insert-new-block!
|
||||||
[state]
|
[state]
|
||||||
|
(reset! *skip-save-block? true)
|
||||||
(let [aux-fn (fn [] (when-not config/publishing?
|
(let [aux-fn (fn [] (when-not config/publishing?
|
||||||
(let [{:keys [block value format id config]} (get-state state)
|
(let [{:keys [block value format id config]} (get-state state)
|
||||||
block-id (:block/uuid block)
|
block-id (:block/uuid block)
|
||||||
|
@ -773,7 +777,9 @@
|
||||||
:with-level? (if last-child true false)
|
:with-level? (if last-child true false)
|
||||||
:new-level (and last-child (:block/level block))
|
:new-level (and last-child (:block/level block))
|
||||||
:blocks-container-id (:id config)
|
:blocks-container-id (:id config)
|
||||||
:current-page (state/get-current-page)}))))]
|
:current-page (state/get-current-page)})
|
||||||
|
|
||||||
|
(js/setTimeout #(reset! *skip-save-block? false) 10))))]
|
||||||
(if @*async-insert-start
|
(if @*async-insert-start
|
||||||
(js/setTimeout aux-fn 20)
|
(js/setTimeout aux-fn 20)
|
||||||
(aux-fn))))
|
(aux-fn))))
|
||||||
|
@ -1296,11 +1302,9 @@
|
||||||
nil)
|
nil)
|
||||||
(state/conj-selection-block! element up?)))))))
|
(state/conj-selection-block! element up?)))))))
|
||||||
|
|
||||||
;; FIXME: temporal fix
|
|
||||||
(defonce *block-adjusted? (atom false))
|
|
||||||
(defn save-block!
|
(defn save-block!
|
||||||
[{:keys [format block id repo dummy?] :as state} value]
|
[{:keys [format block id repo dummy?] :as state} value]
|
||||||
(when-not @*block-adjusted?
|
(when-not @*skip-save-block?
|
||||||
(when (or (:db/id (db/entity repo [:block/uuid (:block/uuid block)]))
|
(when (or (:db/id (db/entity repo [:block/uuid (:block/uuid block)]))
|
||||||
dummy?)
|
dummy?)
|
||||||
(let [value (text/remove-level-spaces value format true)
|
(let [value (text/remove-level-spaces value format true)
|
||||||
|
@ -1598,10 +1602,10 @@
|
||||||
(util/uuid-string? (get config :id)))
|
(util/uuid-string? (get config :id)))
|
||||||
(<= final-level start-level)))
|
(<= final-level start-level)))
|
||||||
(<= (- final-level previous-level) 1))
|
(<= (- final-level previous-level) 1))
|
||||||
(reset! *block-adjusted? true)
|
(reset! *skip-save-block? true)
|
||||||
(save-block-if-changed! block new-value
|
(save-block-if-changed! block new-value
|
||||||
{:indent-left? (= direction :left)})
|
{:indent-left? (= direction :left)})
|
||||||
(js/setTimeout #(reset! *block-adjusted? false) 10))))]
|
(js/setTimeout #(reset! *skip-save-block? false) 10))))]
|
||||||
;; TODO: Not a universal solution
|
;; TODO: Not a universal solution
|
||||||
(if @*async-insert-start
|
(if @*async-insert-start
|
||||||
(js/setTimeout aux-fn 20)
|
(js/setTimeout aux-fn 20)
|
||||||
|
|
Loading…
Reference in New Issue