From deba094724fdcf95a8232b29e6f6451afdfbe289 Mon Sep 17 00:00:00 2001 From: Andelf Date: Wed, 2 Aug 2023 23:27:05 +0800 Subject: [PATCH 1/3] fix(editor): template expansion if ac-ui is blurred See-also: #8728 --- src/main/frontend/handler/editor.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 49ae997d5..a1c63326a 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2139,7 +2139,7 @@ sorted-blocks (drop 1 sorted-blocks))] (when element-id - (insert-command! element-id "" format {})) + (insert-command! element-id "" format {:end-pattern commands/command-trigger})) (let [exclude-properties [:id :template :template-including-parent] content-update-fn (fn [content] (->> content @@ -2696,7 +2696,7 @@ (delete-concat current-block))) :else - (delete-and-update + (delete-and-update input current-pos (util/safe-inc-current-pos-from-start (.-value input) current-pos)))))) (defn keydown-backspace-handler From 6fee36d3e81c0790b2cf3720416d27b5385d2d46 Mon Sep 17 00:00:00 2001 From: Andelf Date: Thu, 3 Aug 2023 00:47:30 +0800 Subject: [PATCH 2/3] fix(editor): error notification when template insert error --- src/main/frontend/handler/editor.cljs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index a1c63326a..ec71633fa 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2161,15 +2161,21 @@ :else true)] - (outliner-tx/transact! - {:outliner-op :insert-blocks - :created-from-journal-template? journal?} - (save-current-block!) - (let [result (outliner-core/insert-blocks! blocks' - target - (assoc opts - :sibling? sibling?'))] - (edit-last-block-after-inserted! result)))))))) + (try + (outliner-tx/transact! + {:outliner-op :insert-blocks + :created-from-journal-template? journal?} + (save-current-block!) + (let [result (outliner-core/insert-blocks! blocks' + target + (assoc opts + :sibling? sibling?'))] + (edit-last-block-after-inserted! result))) + (catch :default ^js/Error e + (notification/show! + [:p.content + (util/format "Template insert error: %s" (.-message e))] + :error)))))))) (defn template-on-chosen-handler [element-id] From 5cd3bec91153c94561a67eb8c3fafaeb30c6777e Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Wed, 16 Aug 2023 00:36:29 +0800 Subject: [PATCH 3/3] fix: can't redirect to block --- src/main/frontend/handler/route.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/frontend/handler/route.cljs b/src/main/frontend/handler/route.cljs index e418fee2e..e54768cd3 100644 --- a/src/main/frontend/handler/route.cljs +++ b/src/main/frontend/handler/route.cljs @@ -73,7 +73,7 @@ (redirect-to-page! page-name {})) ([page-name {:keys [anchor push click-from-recent?] :or {click-from-recent? false}}] - (when (seq page-name) + (when (or (uuid? page-name) (seq page-name)) (recent-handler/add-page-to-recent! (state/get-current-repo) page-name click-from-recent?) (let [m (cond->