diff --git a/src/discourseGraphsMode.ts b/src/discourseGraphsMode.ts index 479ddb51..24221c2e 100644 --- a/src/discourseGraphsMode.ts +++ b/src/discourseGraphsMode.ts @@ -494,6 +494,17 @@ const initializeDiscourseGraphsMode = async (args: OnloadArgs) => { Panel: TextPanel, }, // @ts-ignore + { + title: "open in sidebar", + description: + "Whether or not to open nodes in the sidebar when created", + Panel: FlagPanel, + options: { + onChange: onPageRefObserverChange(previewPageRefHandler), + }, + defaultValue: true, + } as Field, + // @ts-ignore { title: "preview", description: diff --git a/src/utils/createDiscourseNode.ts b/src/utils/createDiscourseNode.ts index 363b1d91..dae6c868 100644 --- a/src/utils/createDiscourseNode.ts +++ b/src/utils/createDiscourseNode.ts @@ -7,6 +7,7 @@ import getFullTreeByParentUid from "roamjs-components/queries/getFullTreeByParen import getSubTree from "roamjs-components/util/getSubTree"; import openBlockInSidebar from "roamjs-components/writes/openBlockInSidebar"; import { DiscourseNode } from "./getDiscourseNodes"; +import isFlagEnabled from "./isFlagEnabled"; type Props = { text: string; @@ -22,6 +23,7 @@ const createDiscourseNode = async ({ discourseNodes, }: Props) => { const handleOpenInSidebar = (uid: string) => { + if (!isFlagEnabled("open in sidebar")) return; openBlockInSidebar(uid); setTimeout(() => { const sidebarTitle = document.querySelector(