From 7437b295182b5368846ff087ae4ff32b59d6d16c Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 12 Nov 2024 13:09:33 +0500 Subject: [PATCH] core: fix type errors in migrations --- packages/core/src/migrations.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/migrations.ts b/packages/core/src/migrations.ts index a6a573753..dd9734f42 100644 --- a/packages/core/src/migrations.ts +++ b/packages/core/src/migrations.ts @@ -624,6 +624,7 @@ function replaceDateEditedWithDateModified(removeDateEditedProperty = false) { function wrapTablesWithDiv(html: string) { const document = parseHTML(html); + if (!document) return html; const tables = document.getElementsByTagName("table"); for (const table of tables) { table.setAttribute("contenteditable", "true"); @@ -640,6 +641,7 @@ function wrapTablesWithDiv(html: string) { function removeToxClassFromChecklist(html: string): string { const document = parseHTML(html); + if (!document) return html; const checklists = document.querySelectorAll( ".tox-checklist,.tox-checklist--checked" ); @@ -686,6 +688,7 @@ export function tinyToTiptap(html: string) { ); const document = parseHTML(html); + if (!document) return html; const tables = document.querySelectorAll("table"); for (const table of tables) {