diff --git a/resources/scripts/annotations/annotations.js b/resources/scripts/annotations/annotations.js
index f683458c..890c017e 100644
--- a/resources/scripts/annotations/annotations.js
+++ b/resources/scripts/annotations/annotations.js
@@ -91,6 +91,7 @@ window.addEventListener("WebComponentsReady", () => {
let autoSave = false;
let type = "";
let emptyElement = false;
+ let elementPosition = "around"; //default position of the annotation element to be inserted; can be also "before" (for ) or "after" (for )
let text = "";
let enablePreview = true;
let currentEntityInfo = null;
@@ -304,7 +305,8 @@ window.addEventListener("WebComponentsReady", () => {
view.addAnnotation({
type,
properties: data,
- before: emptyElement
+ before: emptyElement,
+ position : elementPosition
});
} catch (e) {
document.getElementById('runtime-error-dialog').show('Error', e);
@@ -415,10 +417,15 @@ window.addEventListener("WebComponentsReady", () => {
query: selection
});
}
- emptyElement = false;
+ elementPosition = "around";
+ if (button.classList.contains("after")) {
+ elementPosition = "after";
+ }
if (button.classList.contains("before")) {
- emptyElement = true;
+ elementPosition = "before";
}
+ //if class contains 'before' or 'after' value, it's an empty element
+ emptyElement = (elementPosition != "around");
window.pbEvents.emit("show-annotation", "transcription", {});
showForm(type);
text = selection;
@@ -642,7 +649,8 @@ window.addEventListener("WebComponentsReady", () => {
if (trackHistory) {
document.dispatchEvent(new CustomEvent('pb-before-save', {
detail: {
- user: currentUser
+ user: currentUser,
+ export: false
}
}));
} else {
diff --git a/templates/pages/annotate.html b/templates/pages/annotate.html
index 152caa54..cd3aa4de 100644
--- a/templates/pages/annotate.html
+++ b/templates/pages/annotate.html
@@ -58,7 +58,7 @@
-
+