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