Skip to content

Commit

Permalink
fix: check table element before pasting it as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
gnapse authored Dec 10, 2024
1 parent 5ebfdc5 commit 4825e4f
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 4825e4f

Please sign in to comment.