Fix some typing issues
This commit is contained in:
parent
99ce0ab84d
commit
4584cb860e
|
|
@ -269,7 +269,7 @@ onUnmounted(() => {
|
|||
|
||||
if (element !== null) {
|
||||
console.log('unmounting');
|
||||
element.removeEventListener('mouseup', getSelectionHandler);
|
||||
element.removeEventListener('mouseup', getSelectionHandler(element, props.contentBlock));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ export const getSelectionHandler = (el: HTMLElement, contentBlock: ContentBlockN
|
|||
const paragraph = findClosestAncestorWithTag(startContainer, 'p');
|
||||
const endAncestor = findClosestAncestorWithTag(endContainer, 'p');
|
||||
|
||||
if (paragraph === endAncestor) {
|
||||
if (paragraph && paragraph === endAncestor) {
|
||||
// todo: rename this variable, `parent` is not correct anymore
|
||||
const contentComponent = findClosestAncestorWithClass(startContainer, 'content-component');
|
||||
if (contentComponent) {
|
||||
// our selection is wholly inside the container node, we continue with it
|
||||
const position = findPositionInParent(contentComponent);
|
||||
const siblings = Array.from(paragraph.parentElement.children);
|
||||
const siblings = Array.from(paragraph.parentElement?.children || []);
|
||||
const positionInTextBlock = siblings.indexOf(paragraph);
|
||||
|
||||
const numOfParagraphs = Array.from(contentComponent.children[1].children).filter(
|
||||
|
|
|
|||
Loading…
Reference in New Issue