fix: do not render sections outside workspace
This commit is contained in:
parent
d1e02bf42d
commit
172b6418ba
|
|
@ -68,7 +68,8 @@ export function registerNoteLinkSection(type: "inbound" | "outbound") {
|
|||
setEnabled(false);
|
||||
},
|
||||
onRender: () => {},
|
||||
onAsyncRender: async ({ body, item, setL10nArgs }) => {
|
||||
onAsyncRender: async ({ body, item, setL10nArgs, tabType }) => {
|
||||
if (!item?.isNote()) return;
|
||||
await renderSection(type, {
|
||||
body,
|
||||
item,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ export function openNotePreview(
|
|||
onRender: ({ setSectionSummary }) => {
|
||||
setSectionSummary(noteItem.getNoteTitle());
|
||||
},
|
||||
onAsyncRender: async ({ body }) => {
|
||||
onAsyncRender: async ({ body, item }) => {
|
||||
if (!item?.isNote()) return;
|
||||
const editorElement = body.querySelector("note-editor")! as EditorElement;
|
||||
await waitUtilAsync(() => Boolean(editorElement._initialized));
|
||||
if (!editorElement._initialized) {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ export function registerNoteRelation() {
|
|||
rel="stylesheet"
|
||||
href="chrome://${config.addonRef}/content/styles/workspace/relation.css"
|
||||
></html:link>
|
||||
</linkset>
|
||||
<iframe
|
||||
src="chrome://${config.addonRef}/content/relationGraph.html"
|
||||
id="bn-relation-graph"
|
||||
></iframe>`,
|
||||
</linkset>`,
|
||||
sectionButtons: [
|
||||
{
|
||||
type: "refreshGraph",
|
||||
|
|
@ -83,6 +79,13 @@ export function registerNoteRelation() {
|
|||
},
|
||||
onRender: () => {},
|
||||
onAsyncRender: async ({ body, item }) => {
|
||||
if (!item?.isNote()) return;
|
||||
if (!body.querySelector("#bn-relation-graph")) {
|
||||
const iframe = body.ownerDocument.createXULElement("iframe") as HTMLIFrameElement;
|
||||
iframe.src = `chrome://${config.addonRef}/content/relationGraph.html`;
|
||||
iframe.id = "bn-relation-graph";
|
||||
body.appendChild(iframe);
|
||||
}
|
||||
await renderGraph(body, item);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue