Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-builder",
"version": "1.37.0",
"version": "1.37.1",
"description": "Introduces new user interfaces for building queries in Roam",
"main": "./build/main.js",
"author": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"react-draggable": "^4.4.5",
"react-in-viewport": "^1.0.0-alpha.20",
"react-vertical-timeline-component": "^3.5.2",
"roamjs-components": "^0.83.4",
"roamjs-components": "^0.88.1",
"signia-react": "^0.1.1"
},
"overrides": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ const ExportDialog: ExportDialogComponent = ({
if (event.shiftKey) {
window.roamAlphaAPI.ui.rightSidebar.addWindow({
window: {
"block-uid": uid,
"page-uid": uid,
type: "outline",
},
});
Expand Down
18 changes: 5 additions & 13 deletions src/components/Kanban.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,18 @@ import { Sorts } from "../utils/parseResultSettings";
import getRoamUrl from "roamjs-components/dom/getRoamUrl";

const zPriority = z.record(z.number().min(0).max(1));
const { Block: RenderRoamBlock } = window.roamAlphaAPI.ui.react;
Comment thread
mdroidian marked this conversation as resolved.

type Reprioritize = (args: { uid: string; x: number; y: number }) => void;

const BlockEmbed = ({ uid, viewValue }: { uid: string; viewValue: string }) => {
const title = getPageTitleByPageUid(uid);
const contentRef = useRef(null);
const open =
viewValue === "open" ? true : viewValue === "closed" ? false : null;
useEffect(() => {
const el = contentRef.current;
if (el) {
window.roamAlphaAPI.ui.components.renderBlock({
uid,
el,
// "open?": open, // waiting for roamAlphaAPI to add a open/close to renderBlock
});
}
}, [uid, open, contentRef]);
viewValue === "open" ? true : viewValue === "closed" ? false : undefined;
return (
<div ref={contentRef} className={!!title ? "page-embed" : "block-embed"} />
<div className={!!title ? "page-embed" : "block-embed"}>
<RenderRoamBlock uid={uid} open={open} />
</div>
);
};

Expand Down
49 changes: 12 additions & 37 deletions src/components/ResultsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,15 @@ import { ContextContent } from "./DiscourseContext";

const EXTRA_ROW_TYPES = ["context", "discourse"] as const;
type ExtraRowType = (typeof EXTRA_ROW_TYPES)[number] | null;
const { Block: RenderRoamBlock, Page: RenderRoamPage } =
window.roamAlphaAPI.ui.react;
Comment thread
mdroidian marked this conversation as resolved.

const ExtraContextRow = ({ uid }: { uid: string }) => {
const containerRef = useRef<HTMLDivElement>(null);

useEffect(() => {
if (!containerRef.current) return;
if (getPageTitleByPageUid(uid)) {
window.roamAlphaAPI.ui.components.renderPage({
uid,
el: containerRef.current,
hideMentions: true,
});
} else {
window.roamAlphaAPI.ui.components.renderBlock({
uid,
el: containerRef.current,
zoomPath: true,
});
}
}, [containerRef, uid]);

return <div ref={containerRef} />;
return getPageTitleByPageUid(uid) ? (
<RenderRoamPage uid={uid} hideMentions />
) : (
<RenderRoamBlock uid={uid} zoomPath />
);
};

const dragImage = document.createElement("img");
Expand Down Expand Up @@ -166,25 +153,13 @@ const ResultHeader = React.forwardRef<

const CellEmbed = ({ uid, viewValue }: { uid: string; viewValue: string }) => {
const title = getPageTitleByPageUid(uid);
const contentRef = useRef(null);
useEffect(() => {
const el = contentRef.current;
const open =
viewValue === "open" ? true : viewValue === "closed" ? false : null;
if (el) {
window.roamAlphaAPI.ui.components.renderBlock({
uid,
el,
// "open?": open, // waiting for roamAlphaAPI to add a open/close to renderBlock
});
}
}, [contentRef]);
const open =
viewValue === "open" ? true : viewValue === "closed" ? false : undefined;
return (
<div className="roamjs-query-embed">
<div
ref={contentRef}
className={!!title ? "page-embed" : "block-embed"}
/>
<div className={!!title ? "page-embed" : "block-embed"}>
<RenderRoamBlock uid={uid} open={open} />
</div>
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ svg.rs-svg-container {
).then((blockUid) =>
queryRender({
blockUid,
clearOnClick,
onloadArgs,
})
),
Expand Down
3 changes: 3 additions & 0 deletions src/utils/getExportTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const pullBlockToTreeNode = (n: PullBlock, v: `:${ViewType}`): TreeNode => ({
uid: n[":block/uid"] || "",
heading: n[":block/heading"] || 0,
viewType: (n[":children/view-type"] || v).slice(1) as ViewType,
blockViewType: (n[":block/view-type"] || ":vertical").slice(
1
) as TreeNode["blockViewType"],
editTime: new Date(n[":edit/time"] || 0),
props: { imageResize: {}, iframe: {} },
textAlign: n[":block/text-align"] || "left",
Expand Down
Loading