Skip to content

Commit

Permalink
fix: Check table element before pasting it as a string (#977)
Browse files Browse the repository at this point in the history
fix: check table element before pasting it as a string
  • Loading branch information
gnapse authored Dec 11, 2024
1 parent 868f683 commit 954568e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/extensions/shared/paste-html-table-as-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 954568e

Please sign in to comment.