From 87f8ca4440dae9062a30e0c1f3251c7414a4e6c4 Mon Sep 17 00:00:00 2001
From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr>
Date: Mon, 5 Feb 2024 23:25:48 +0100
Subject: [PATCH] Add manifest network support from id suffix

---
 src/annotationForm/AnnotationFormFooter.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/annotationForm/AnnotationFormFooter.js b/src/annotationForm/AnnotationFormFooter.js
index 42b301f..f7beb0e 100644
--- a/src/annotationForm/AnnotationFormFooter.js
+++ b/src/annotationForm/AnnotationFormFooter.js
@@ -61,6 +61,12 @@ function AnnotationFormFooter({
 
     const annotationText = (!textBody.length && target.t) ? `${secondsToHMS(tstart)} -> ${secondsToHMS(tend)}` : textBody;
 
+    let id = annotation?.id ? annotation.id : `https://${uuid()}`;
+    id = id.split('#')[0];
+    if (manifestNetwork) {
+      id = `${id}#${manifestNetwork}`;
+    }
+
     const annotationToSaved = {
       body: {
         id: null, // Will be updated after
@@ -69,7 +75,7 @@ function AnnotationFormFooter({
         value: annotationText,
       },
       drawingState: JSON.stringify(drawingState),
-      id: (annotation && annotation.id) || `${uuid()}`,
+      id,
       manifestNetwork,
       motivation: 'commenting',
       target: null,
-- 
GitLab