Browse Source

fix: Template properties causes empty "template" property to show up

address #6839
Tienson Qin 3 years ago
parent
commit
00c1a238c1
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/main/frontend/handler/editor.cljs

+ 6 - 0
src/main/frontend/handler/editor.cljs

@@ -1988,6 +1988,12 @@
            root-block (db/pull db-id)
            blocks-exclude-root (remove (fn [b] (= (:db/id b) db-id)) blocks)
            sorted-blocks (tree/sort-blocks blocks-exclude-root root-block)
+           sorted-blocks (cons
+                          (-> (first sorted-blocks)
+                              (update :block/properties-text-values dissoc :template)
+                              (update :block/properties-order (fn [keys]
+                                                                (vec (remove #{:template} keys)))))
+                          (rest sorted-blocks))
            blocks (if template-including-parent?
                     sorted-blocks
                     (drop 1 sorted-blocks))]