Skip to content

Commit

Permalink
Add option to not open nodes in sidebar on create (Closes #176) (#177)
Browse files Browse the repository at this point in the history
* Add option to not open nodes in sidebar on create

* rm options

* reverse sidebar open flag title and description

* 1.14.0

* 1.15.0
  • Loading branch information
mdroidian authored Nov 30, 2023
1 parent 27134b8 commit d753268
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-builder",
"version": "1.14.0",
"version": "1.15.0",
"description": "Introduces new user interfaces for building queries in Roam",
"main": "./build/main.js",
"author": {
Expand Down
7 changes: 7 additions & 0 deletions src/discourseGraphsMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,13 @@ const initializeDiscourseGraphsMode = async (args: OnloadArgs) => {
Panel: TextPanel,
},
// @ts-ignore
{
title: "disable sidebar open",
description:
"Disable opening new nodes in the sidebar when created",
Panel: FlagPanel,
} as Field<FlagField>,
// @ts-ignore
{
title: "preview",
description:
Expand Down
2 changes: 2 additions & 0 deletions src/utils/createDiscourseNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,6 +23,7 @@ const createDiscourseNode = async ({
discourseNodes,
}: Props) => {
const handleOpenInSidebar = (uid: string) => {
if (isFlagEnabled("disable sidebar open")) return;
openBlockInSidebar(uid);
setTimeout(() => {
const sidebarTitle = document.querySelector(
Expand Down

0 comments on commit d753268

Please sign in to comment.