diff --git a/src/extensions/shared/paste-html-table-as-string.ts b/src/extensions/shared/paste-html-table-as-string.ts index ae4a1a0b..d0791a4f 100644 --- a/src/extensions/shared/paste-html-table-as-string.ts +++ b/src/extensions/shared/paste-html-table-as-string.ts @@ -35,13 +35,13 @@ const PasteHTMLTableAsString = Extension.create({ // Concatenate all tables into a single string of paragraphs return tableHTML.reduce((result, table) => { - const { firstElementChild: tableElement } = parseHtmlToElement( - table, - ) as { - firstElementChild: HTMLTableElement | null - } + const { firstElementChild: tableElement } = parseHtmlToElement(table) - if (!tableElement) { + if ( + !tableElement || + !(tableElement instanceof HTMLTableElement) || + !tableElement.rows + ) { return result }