Add option to insert block without focusing it afterwards

pull/7373/head
Manu [tennox] 2022-11-16 19:17:39 +00:00 committed by Tienson Qin
parent dd7460f198
commit 4217057a44
2 changed files with 4 additions and 1 deletions

View File

@ -592,6 +592,7 @@ export interface IEditorProxy extends Record<string, any> {
before: boolean
sibling: boolean
isPageBlock: boolean
focus: boolean
customUUID: string
properties: {}
}>

View File

@ -525,9 +525,10 @@
(def ^:export insert_block
(fn [block-uuid-or-page-name content ^js opts]
(let [{:keys [before sibling isPageBlock customUUID properties]} (bean/->clj opts)
(let [{:keys [before sibling focus isPageBlock customUUID properties]} (bean/->clj opts)
page-name (and isPageBlock block-uuid-or-page-name)
custom-uuid (or customUUID (:id properties))
edit-block? (if (nil? focus) true focus)
_ (when (not (string/blank? custom-uuid))
(when-not (util/uuid-string? custom-uuid)
(throw (js/Error.
@ -557,6 +558,7 @@
{:block-uuid block-uuid'
:sibling? sibling?
:before? before?
:edit-block? edit-block?
:page page-name
:custom-uuid custom-uuid
:properties (merge properties