From 4217057a44de65e5c64be37857af2fb4e9534b24 Mon Sep 17 00:00:00 2001 From: "Manu [tennox]" <2084639+tennox@users.noreply.github.com> Date: Wed, 16 Nov 2022 19:17:39 +0000 Subject: [PATCH] Add option to insert block without focusing it afterwards --- libs/src/LSPlugin.ts | 1 + src/main/logseq/api.cljs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/src/LSPlugin.ts b/libs/src/LSPlugin.ts index 476dcba6c..630747ea2 100644 --- a/libs/src/LSPlugin.ts +++ b/libs/src/LSPlugin.ts @@ -592,6 +592,7 @@ export interface IEditorProxy extends Record { before: boolean sibling: boolean isPageBlock: boolean + focus: boolean customUUID: string properties: {} }> diff --git a/src/main/logseq/api.cljs b/src/main/logseq/api.cljs index a24280900..1fc7eae33 100644 --- a/src/main/logseq/api.cljs +++ b/src/main/logseq/api.cljs @@ -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