Commit 64b03d89 authored by dindigala's avatar dindigala
Browse files

Merge branch 'issue/#330-hover-tooltip' into 'develop'

fix/#330: hover over tooltip for outer spans and it's selected text

See merge request !214
parents bb23eeea b455cf43
Pipeline #223933 passed with stages
in 4 minutes and 23 seconds
......@@ -386,23 +386,38 @@ export default {
},
onMouseHover(el, annotationClasses) {
const queue = [];
const innerQueue = [];
// this logic checks the child spans and classes.
queue.push(el);
// this logic checks the child spans and their classes.
innerQueue.push(el);
let matched = false;
while (queue.length) {
const popped = queue.pop();
while (innerQueue.length) {
const popped = innerQueue.pop();
if (parseInt(popped.getAttribute('data-annotation-level'), 10) > 0) {
matched = true;
} else {
[...popped.children].forEach((child) => {
queue.push(child);
innerQueue.push(child);
});
}
}
// this logic checks the outer spans and their classes.
if (!matched) {
const outerQueue = [];
outerQueue.push(el);
while (outerQueue.length) {
const popped = outerQueue.pop();
if (parseInt(popped.getAttribute('data-annotation-level'), 10) > 0) {
matched = true;
} else if (popped.parentElement.getAttribute('data-annotation')) {
outerQueue.push(popped.parentElement);
}
}
}
if (!el || !matched) {
return;
}
......
......@@ -31,7 +31,7 @@
-->
<script id="tido-config" type="application/json">
{
"entrypoint": "",
"entrypoint": "https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/syriac/collection.json",
"annotations": {
"show": true,
"types": [
......
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