Просмотр исходного кода

fix: typing hashtag sets heading

also remove unused var
Gabriel Horner 1 год назад
Родитель
Сommit
ead9f30f1b

+ 0 - 17
deps/db/src/logseq/db/frontend/schema.cljs

@@ -158,23 +158,6 @@
     :block/macros
     :block/warning})
 
-
-;;; use `(map [:db.fn/retractAttribute <id> <attr>] retract-page-attributes)`
-;;; to remove attrs to make the page as it's just created and no file attached to it
-(def retract-page-attributes
-  #{:block/created-at
-    :block/updated-at
-    :block/file
-    :block/format
-    :block/content
-    :block/properties
-    :block/properties-order
-    :block/properties-text-values
-    :block/invalid-properties
-    :block/alias
-    :block/tags})
-
-
 ;; DB graph helpers
 ;; ================
 (def ref-type-attributes

+ 1 - 1
deps/outliner/src/logseq/outliner/core.cljs

@@ -294,7 +294,7 @@
           block-entity (d/entity db eid)
           m (cond-> m*
               db-based?
-              (dissoc :block/priority :block/marker)
+              (dissoc :block/priority :block/marker :block/properties-order)
               db-based?
               (update :block/tags (fn [tags]
                                       (concat (keep :db/id (:block/tags block-entity))

+ 8 - 6
src/main/frontend/handler/db_based/editor.cljs

@@ -79,12 +79,14 @@
                       first-elem-type (first (ffirst ast))
                       block-with-title? (mldoc/block-with-title? first-elem-type)
                       content' (str (config/get-block-pattern :markdown) (if block-with-title? " " "\n") content)
-                      block' (merge block
-                                    (block/parse-block (assoc block :block/content content'))
-                                    {:block/content content})
-                      block' (if (seq (:block/properties block))
-                               (update block' :block/properties (fn [m] (merge m (:block/properties block))))
-                               block')]
+                      parsed-block (block/parse-block (assoc block :block/content content'))
+                      parsed-block' (cond-> (dissoc parsed-block :block/properties)
+                                      (:block/properties parsed-block)
+                                      (merge (update-keys (:block/properties parsed-block)
+                                                          (fn [k]
+                                                            (or ({:heading :logseq.property/heading} k)
+                                                                (throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {})))))))
+                      block' (merge block parsed-block' {:block/content content})]
                   (update block' :block/refs remove-non-existed-refs!)))
         result (-> block
                    (merge (if level {:block/level level} {}))