More CSS class cleanup

This commit is contained in:
Rainer Simon 2020-04-04 15:54:26 +02:00
parent 761794054e
commit 6c2cb7d98d
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ export const getNodeForEvent = function(evt) {
const sortByQuoteLengthDesc = annotations => const sortByQuoteLengthDesc = annotations =>
annotations.sort((a, b) => a.quote.length - b.quote.length); annotations.sort((a, b) => a.quote.length - b.quote.length);
const annotationSpan = evt.target.closest('.annotation'); const annotationSpan = evt.target.closest('.r6o-annotation');
if (annotationSpan) { if (annotationSpan) {
// All stacked annotation spans // All stacked annotation spans
@ -27,7 +27,7 @@ export const getNodeForEvent = function(evt) {
const annotation = sortByQuoteLengthDesc(spans.map(span => span.annotation))[0]; const annotation = sortByQuoteLengthDesc(spans.map(span => span.annotation))[0];
// ALL spans for this annotation (not just the hovered one) // ALL spans for this annotation (not just the hovered one)
const elements = document.querySelectorAll(`.annotation[data-id="${annotation.id}"]`); const elements = document.querySelectorAll(`.r6o-annotation[data-id="${annotation.id}"]`);
return { annotation, elements: Array.from(elements) }; return { annotation, elements: Array.from(elements) };
} }
@ -50,6 +50,6 @@ export const getAnnotationSpansRecursive = function(element, s) {
const parent = element.parentNode; const parent = element.parentNode;
return parent.classList.contains('annotation') ? return parent.classList.contains('r6o-annotation') ?
getAnnotationSpansRecursive(parent, spans) : spans; getAnnotationSpansRecursive(parent, spans) : spans;
} }

View File

@ -99,7 +99,7 @@ export default class DrawingTool extends EventEmitter {
} }
/** Emphasise hovered annotation **/ /** Emphasise hovered annotation **/
onEnterAnnotation = delegatingHandler('.annotation', evt => { onEnterAnnotation = delegatingHandler('.r6o-annotation', evt => {
if (this.currentHover) if (this.currentHover)
this.hover(); this.hover();
@ -107,7 +107,7 @@ export default class DrawingTool extends EventEmitter {
}); });
/** Clear hover emphasis **/ /** Clear hover emphasis **/
onLeaveAnnotation = delegatingHandler('.annotation', evt => { onLeaveAnnotation = delegatingHandler('.r6o-annotation', evt => {
this.hover(); this.hover();
}); });