fix: renaming a page without TITLE eats characters of the first line

Related to #1510
This commit is contained in:
Tienson Qin
2021-03-30 22:55:48 +08:00
parent 4132d9ed1f
commit 58980188a8
4 changed files with 24 additions and 14 deletions

View File

@@ -147,11 +147,13 @@
property-names (keys properties)]
(and (every? #(contains? #{:title :filters} %) property-names)
(let [ast (mldoc/->edn (:block/content block) (mldoc/default-config (:block/format block)))]
(or
(empty? (rest ast))
(every? (fn [[[typ break-lines]] _]
(and (= typ "Paragraph")
(every? #(= % ["Break_Line"]) break-lines))) (rest ast))))))))
(and
(= "Properties" (ffirst (first ast)))
(or
(empty? (rest ast))
(every? (fn [[[typ break-lines]] _]
(and (= typ "Paragraph")
(every? #(= % ["Break_Line"]) break-lines))) (rest ast)))))))))
(defn with-dummy-block
([blocks format]