|
|
@@ -1,11 +1,8 @@
|
|
|
(ns frontend.modules.outliner.pipeline
|
|
|
- (:require [clojure.string :as string]
|
|
|
- [frontend.config :as config]
|
|
|
+ (:require [frontend.config :as config]
|
|
|
[frontend.db :as db]
|
|
|
[frontend.db.react :as react]
|
|
|
- [frontend.handler.file-based.property.util :as property-util]
|
|
|
[frontend.state :as state]
|
|
|
- [frontend.util.drawer :as drawer]
|
|
|
[frontend.modules.editor.undo-redo :as undo-redo]
|
|
|
[datascript.core :as d]
|
|
|
[frontend.handler.ui :as ui-handler]
|
|
|
@@ -13,27 +10,6 @@
|
|
|
[logseq.db :as ldb]
|
|
|
[promesa.core :as p]))
|
|
|
|
|
|
-(defn- reset-editing-block-content!
|
|
|
- [tx-data]
|
|
|
- (let [repo (state/get-current-repo)
|
|
|
- db? (config/db-based-graph? repo)]
|
|
|
- (when-let [edit-block (state/get-edit-block)]
|
|
|
- (when-let [last-datom (-> (filter (fn [datom]
|
|
|
- (and (= :block/content (:a datom))
|
|
|
- (= (:e datom) (:db/id edit-block)))) tx-data)
|
|
|
- last)]
|
|
|
- (when-let [input (state/get-input)]
|
|
|
- (when (:added last-datom)
|
|
|
- (let [entity (db/entity (:e last-datom))
|
|
|
- db-content (:block/content entity)
|
|
|
- content (if db? db-content
|
|
|
- (->> db-content
|
|
|
- (property-util/remove-built-in-properties (or (:block/format entity) :markdown))
|
|
|
- drawer/remove-logbook))]
|
|
|
- (when (not= (string/trim content)
|
|
|
- (string/trim (.-value input)))
|
|
|
- (state/set-edit-content! input content)))))))))
|
|
|
-
|
|
|
(defn store-undo-data!
|
|
|
[{:keys [tx-meta] :as opts}]
|
|
|
(when-not config/test?
|
|
|
@@ -94,12 +70,6 @@
|
|
|
(react/clear-query-state!)
|
|
|
(ui-handler/re-render-root!))
|
|
|
(do
|
|
|
- (try
|
|
|
- (reset-editing-block-content! tx-data)
|
|
|
- (catch :default e
|
|
|
- (prn :reset-editing-block-content)
|
|
|
- (js/console.error e)))
|
|
|
-
|
|
|
(when-not (:graph/importing @state/state)
|
|
|
(react/refresh! repo tx-report affected-keys)
|
|
|
|