From 00c1a238c176d6f4ebf32f105c5974dad1cabfdb Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Thu, 29 Sep 2022 10:44:16 +0800 Subject: [PATCH 1/2] fix: Template properties causes empty "template" property to show up address #6839 --- src/main/frontend/handler/editor.cljs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 8ed1bda0e..ad0c83cb4 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/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))] From 066496089fdd2f1c749909d2e552d780ce5cd416 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Thu, 29 Sep 2022 12:07:31 +0800 Subject: [PATCH 2/2] fix: disallow creation of a page that starts with # related to #6840 --- src/main/frontend/handler/page.cljs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/handler/page.cljs b/src/main/frontend/handler/page.cljs index 5204aa9d3..955831898 100644 --- a/src/main/frontend/handler/page.cljs +++ b/src/main/frontend/handler/page.cljs @@ -35,6 +35,7 @@ [promesa.core :as p] [frontend.mobile.util :as mobile-util] [logseq.graph-parser.util :as gp-util] + [logseq.graph-parser.text :as text] [logseq.graph-parser.config :as gp-config] [logseq.graph-parser.block :as gp-block] [logseq.graph-parser.property :as gp-property] @@ -136,7 +137,10 @@ properties nil split-namespace? true uuid nil}}] - (let [title (string/trim title) + (let [title (-> (string/trim title) + (text/page-ref-un-brackets!) + ;; remove `#` from tags + (string/replace #"^#+" "")) title (gp-util/remove-boundary-slashes title) page-name (util/page-name-sanity-lc title) repo (state/get-current-repo)