Commit f6e6a50b authored by dindigala's avatar dindigala
Browse files

refactor: updated to display nested values in tooltip

parent 255907b0
Pipeline #218369 passed with stages
in 3 minutes and 57 seconds
......@@ -291,15 +291,29 @@ export default {
}, {});
document.querySelectorAll('[data-annotation]').forEach((el) => {
const annotationClasses = el.className.split(' ').map((x) => annotationIds[x]).filter((x) => x);
const childOtherNodes = [...el.childNodes].filter((x) => x.nodeName !== '#text').length;
if (annotationClasses.length && !childOtherNodes) {
el.addEventListener('mouseenter', () => this.onMouseHover(el, annotationClasses), false);
el.addEventListener('mouseout', () => this.onMouseOut(el), false);
if (!childOtherNodes) {
const annotationClasses = this.backTrackNestedAnnotations(el).className.split(' ').map((x) => annotationIds[x]).filter((x) => x);
if (annotationClasses.length) {
el.addEventListener('mouseenter', () => this.onMouseHover(el, annotationClasses), false);
el.addEventListener('mouseout', () => this.onMouseOut(el), false);
}
}
});
},
backTrackNestedAnnotations(el) {
let current = el;
while (current.parentElement.getAttribute('data-annotation') && current.parentElement.childNodes.length === 1) {
current = current.parentElement;
}
return current;
},
onContentUpdate(ids) {
try {
this.currentTab = this.annotationTabs[0].key;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment