From 2f40ea4adb60b8d52650e962787577d19ba73a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 13 Feb 2022 15:46:55 +0100 Subject: [PATCH] [ui] add a link to a8s editor display --- .../display/blobs/ImageViewer.svelte | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/webui/src/components/display/blobs/ImageViewer.svelte b/webui/src/components/display/blobs/ImageViewer.svelte index 78c35b3..b238da5 100644 --- a/webui/src/components/display/blobs/ImageViewer.svelte +++ b/webui/src/components/display/blobs/ImageViewer.svelte @@ -2,6 +2,7 @@ import type { PutResult } from "upend/types"; import { fetchEntity, useEntity } from "../../../lib/entity"; import Spinner from "../../utils/Spinner.svelte"; + import UpObject from "../UpObject.svelte"; export let address: string; export let editable: boolean; @@ -71,6 +72,9 @@ }); } + let a8sLinkTarget: HTMLDivElement; + let a8sLinkAddress: string; + async function loaded() { imageLoaded = true; const { Annotorious } = await import("@recogito/annotorious"); @@ -79,7 +83,13 @@ image: imageEl, drawOnSingleClick: true, fragmentUnit: "percent", - widgets: ["COMMENT"], + widgets: [ + "COMMENT", + (info: { annotation: W3cAnnotation }) => { + a8sLinkAddress = info.annotation?.id; + return a8sLinkTarget; + }, + ], }); anno.on("createAnnotation", async (annotation) => { @@ -170,6 +180,13 @@ bind:this={imageEl} draggable="false" /> +