diff --git a/client/src/helpers/highlight.ts b/client/src/helpers/highlight.ts index 3956df57..6369f351 100644 --- a/client/src/helpers/highlight.ts +++ b/client/src/helpers/highlight.ts @@ -161,7 +161,8 @@ export const getSelectionHandler = // the selection is inside our container, so we can do something with it const { startContainer, endContainer } = range; // todo: handle case with paragraphs and list items - if (startContainer.parentElement && isNotHighlightable(startContainer.parentElement)) { + const div_ancestor = findClosestAncestorWithTag(startContainer, 'div'); + if (div_ancestor && isNotHighlightable(div_ancestor)) { return; } const startAncestor = findClosestAncestorWithTag(startContainer, ['p', 'li']); @@ -178,10 +179,6 @@ export const getSelectionHandler = const selector = parentSelector ? parentSelector : 'content-component'; const contentComponent = findClosestAncestorWithClass(startContainer, selector); if (contentComponent) { - if (isNotHighlightable(contentComponent)) { - return; - } - // our selection is wholly inside the container node, we continue with it const position = findPositionInParent(contentComponent); const uuid = contentComponent.dataset.uuid || ''; @@ -233,7 +230,7 @@ export const getSelectionHandler = }; const isNotHighlightable = (element: HTMLElement) => { - const nonHighlightableClasses = ['content-component--solution', 'solution-text']; + const nonHighlightableClasses = ['solution__hidden']; return [...element.classList].some((value) => nonHighlightableClasses.includes(value)); };