diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index c91b398e60..72c73959ea 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2071,9 +2071,7 @@ (filter (fn [ref] (and (vector? ref) (= :block/uuid (first ref))))))] (when (seq block-refs) (db/transact! (map (fn [[_ id]] {:block/uuid id}) block-refs))) - (paste-blocks - blocks - opts))) + (paste-blocks blocks opts))) (defn insert-block-tree-after-target "`tree-vec`: a vector of blocks. diff --git a/src/main/frontend/handler/external.cljs b/src/main/frontend/handler/external.cljs index 7675ad542a..ebe332eac4 100644 --- a/src/main/frontend/handler/external.cljs +++ b/src/main/frontend/handler/external.cljs @@ -122,20 +122,22 @@ page-format (or (some-> tree (:children) (first) (:format)) :markdown)] (try (page-handler/create! title {:redirect? false :format page-format - :uuid uuid}) - (catch :default e - (notification/show! (str "Error happens when creating page " title ":\n" - e - "\nSkipped and continue the remaining import.") :error))) + :uuid uuid + :create-first-block? false}) + (catch :default e + (js/console.error e) + (notification/show! (str "Error happens when creating page " title ":\n" + e + "\nSkipped and continue the remaining import.") :error))) (when has-children? - (let [page-block (db/entity [:block/name (util/page-name-sanity-lc title)]) - first-child (first (:block/_left page-block)) ] + (let [page-block (db/entity [:block/name (util/page-name-sanity-lc title)])] ;; Missing support for per block format (or deprecated?) (try (editor/insert-block-tree children page-format - {:target-block first-child - :sibling? true + {:target-block page-block + :sibling? false :keep-uuid? true}) (catch :default e + (js/console.error e) (notification/show! (str "Error happens when creating block content of page " title "\n" e "\nSkipped and continue the remaining import.") :error)))))) diff --git a/src/main/frontend/modules/outliner/datascript.cljs b/src/main/frontend/modules/outliner/datascript.cljs index 57aa6201a6..1baf76857a 100644 --- a/src/main/frontend/modules/outliner/datascript.cljs +++ b/src/main/frontend/modules/outliner/datascript.cljs @@ -139,8 +139,8 @@ (not (contains? (:file/unlinked-dirs @state/state) (config/get-repo-dir repo))))) - (prn "[DEBUG] Outliner transact:") - (frontend.util/pprint {:txs txs :opts opts}) + ;; (prn "[DEBUG] Outliner transact:") + ;; (frontend.util/pprint {:txs txs :opts opts}) (try (let [repo (get opts :repo (state/get-current-repo)) diff --git a/src/main/frontend/modules/outliner/pipeline.cljs b/src/main/frontend/modules/outliner/pipeline.cljs index bdcd37aa73..ec8ac67240 100644 --- a/src/main/frontend/modules/outliner/pipeline.cljs +++ b/src/main/frontend/modules/outliner/pipeline.cljs @@ -9,7 +9,8 @@ [clojure.set :as set] [datascript.core :as d] [electron.ipc :as ipc] - [promesa.core :as p])) + [promesa.core :as p] + [frontend.config :as config])) (defn updated-page-hook [tx-report page] @@ -145,7 +146,7 @@ (when-not importing? (react/refresh! repo tx-report')) - (when-not (:skip-persist? tx-meta) + (when (and (config/db-only? repo) (not (:skip-persist? tx-meta))) (let [upsert-blocks (->> blocks (remove (fn [b] (contains? deleted-block-uuids (:block/uuid b)))) (map (fn [b]