diff options
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index b38db9a1e..2285cb7e1 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -755,6 +755,17 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu const cm = ContextMenu.Instance; if (!cm) return; + cm.addItem({ + description: "make hypothesis link", event: () => { + const docUrl = Utils.prepend("/doc/" + this.props.Document[Id]); + const docTitle = StrCast(this.layoutDoc.title); + document.dispatchEvent(new CustomEvent<{ url: string, title: string }>("linkRequest", { + detail: { url: docUrl, title: docTitle }, + bubbles: true + })); + }, icon: "eye" + }); + const customScripts = Cast(this.props.Document.contextMenuScripts, listSpec(ScriptField), []); Cast(this.props.Document.contextMenuLabels, listSpec("string"), []).forEach((label, i) => cm.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" })); |