enhance(editor): make it easier to edit page's properties (tags, alias)

This commit is contained in:
Tienson Qin
2020-12-20 17:51:50 +08:00
parent 4799bd6403
commit 04b63ad52a
5 changed files with 46 additions and 49 deletions

View File

@@ -125,19 +125,6 @@
:block/collapsed? false})
block-ids))))
(defn pre-block-with-only-title?
[repo block-id]
(when-let [block (db/entity repo [:block/uuid block-id])]
(let [properties (:page/properties (:block/page block))]
(and (:title properties)
(= 1 (count properties))
(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))))))))
(defn with-dummy-block
([blocks format]
(with-dummy-block blocks format {} {}))
@@ -178,4 +165,4 @@
:block/marker nil
:block/pre-block? false})
default-option)]
(conj blocks dummy))))))
(conj blocks dummy))))))