Merge branch 'master' into feat/db

pull/10050/head
Tienson Qin 2023-08-16 00:41:47 +08:00
commit 517505cf53
2 changed files with 17 additions and 11 deletions

View File

@ -2065,7 +2065,7 @@
sorted-blocks sorted-blocks
(drop 1 sorted-blocks))] (drop 1 sorted-blocks))]
(when element-id (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] (let [exclude-properties [:id :template :template-including-parent]
content-update-fn (fn [content] content-update-fn (fn [content]
(->> content (->> content
@ -2087,15 +2087,21 @@
:else :else
true)] true)]
(outliner-tx/transact! (try
{:outliner-op :insert-blocks (outliner-tx/transact!
:created-from-journal-template? journal?} {:outliner-op :insert-blocks
(save-current-block!) :created-from-journal-template? journal?}
(let [result (outliner-core/insert-blocks! blocks' (save-current-block!)
target (let [result (outliner-core/insert-blocks! blocks'
(assoc opts target
:sibling? sibling?'))] (assoc opts
(edit-last-block-after-inserted! result)))))))) :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 (defn template-on-chosen-handler
[element-id] [element-id]

View File

@ -75,7 +75,7 @@
(redirect-to-page! page-name {})) (redirect-to-page! page-name {}))
([page-name {:keys [anchor push click-from-recent?] ([page-name {:keys [anchor push click-from-recent?]
:or {click-from-recent? false}}] :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 (recent-handler/add-page-to-recent! (state/get-current-repo) page-name
click-from-recent?) click-from-recent?)
(let [m (cond-> (let [m (cond->