fix(highlights_list): unable to scroll to text fragments

This commit is contained in:
Elian Doran 2025-12-18 13:45:45 +02:00
parent 751a874c51
commit 28d9d98964
No known key found for this signature in database

View File

@ -117,7 +117,12 @@ function EditableTextHighlightsList() {
const domPos = domConverter.viewPositionToDom(viewPos);
if (!domPos) return;
(domPos.parent as HTMLElement).scrollIntoView();
if (domPos.parent instanceof HTMLElement) {
domPos.parent.scrollIntoView();
} else if (domPos.parent instanceof Text) {
domPos.parent.parentElement?.scrollIntoView();
}
}, [ textEditor ]);
return <AbstractHighlightsList