[ui] allow for moving annotations
parent
bd24f1f01d
commit
ec094f507a
|
@ -144,15 +144,25 @@
|
||||||
anno.on("updateAnnotation", async (annotation) => {
|
anno.on("updateAnnotation", async (annotation) => {
|
||||||
const annotationObject = await fetchEntity(annotation.id);
|
const annotationObject = await fetchEntity(annotation.id);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
annotationObject.attr["LBL"].map(async (e) => {
|
annotationObject.attr["LBL"]
|
||||||
fetch(`api/obj/${e.address}`, { method: "DELETE" });
|
.concat(annotationObject.attr["W3C_FRAGMENT_SELECTOR"])
|
||||||
})
|
.map(async (e) => {
|
||||||
|
fetch(`api/obj/${e.address}`, { method: "DELETE" });
|
||||||
|
})
|
||||||
);
|
);
|
||||||
await fetch("api/obj", {
|
await fetch("api/obj", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(
|
body: JSON.stringify([
|
||||||
annotation.body.map((body) => {
|
{
|
||||||
|
entity: annotation.id,
|
||||||
|
attribute: "W3C_FRAGMENT_SELECTOR",
|
||||||
|
value: {
|
||||||
|
t: "String",
|
||||||
|
c: annotation.target.selector.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...annotation.body.map((body) => {
|
||||||
return {
|
return {
|
||||||
entity: annotation.id,
|
entity: annotation.id,
|
||||||
attribute: "LBL",
|
attribute: "LBL",
|
||||||
|
@ -161,8 +171,8 @@
|
||||||
c: body.value,
|
c: body.value,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
),
|
]),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
anno.on("deleteAnnotation", async (annotation) => {
|
anno.on("deleteAnnotation", async (annotation) => {
|
||||||
|
|
Loading…
Reference in New Issue