From dc7f4055ac477858122424ceb5ea3fbb45a92b90 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 4 Jan 2021 20:53:36 +0800 Subject: [PATCH] fix(editor): keep block properties when save --- src/main/frontend/components/content.cljs | 4 +++- src/main/frontend/handler/editor.cljs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/components/content.cljs b/src/main/frontend/components/content.cljs index ecb65103e6..51c022dfe4 100644 --- a/src/main/frontend/components/content.cljs +++ b/src/main/frontend/components/content.cljs @@ -131,7 +131,9 @@ (ui/menu-link {:key "Convert heading" :on-click (fn [_e] - (editor-handler/set-block-as-a-heading! block-id (not heading?)))} + (if heading? + (editor-handler/remove-block-property! block-id "heading") + (editor-handler/set-block-as-a-heading! block-id true)))} (if heading? "Convert back to a block" "Convert to a heading")) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 1140f8953f..9900751df4 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -466,8 +466,10 @@ (assoc new-properties :old_permalink (:permalink old-properties)) new-properties) text-properties (text/extract-properties value) - properties (->> custom-properties - (merge text-properties)) + old-hidden-properties (select-keys (:block/properties block) text/hidden-properties) + properties (merge old-hidden-properties + text-properties + custom-properties) properties (if (and (seq properties) (seq remove-properties)) (medley/remove-keys (fn [k] (contains? (set remove-properties) k)) properties) properties)