Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: do not touch lists during migration

thecodrrff6463f9016c
diff --git a/packages/core/migrations.js b/packages/core/migrations.js
index 5a829a259..18cd371ed 100644
--- a/packages/core/migrations.js
+++ b/packages/core/migrations.js
@@ -94,12 +94,17 @@ function decodeWrappedTableHtml(html) {
}
export function tinyToTiptap(html) {
+ if (typeof html !== "string") return html;
+
const document = parseHTML(html);
const tables = document.querySelectorAll("table");
for (const table of tables) {
table.removeAttribute("contenteditable");
- if (table.parentElement?.nodeName.toLowerCase() === "div") {
+ if (
+ table.parentElement &&
+ table.parentElement.nodeName.toLowerCase() === "div"
+ ) {
table.parentElement.replaceWith(table);
}
}
@@ -119,15 +124,6 @@ export function tinyToTiptap(html) {
if (!p.childNodes.length) p.remove();
}
- const listItems = document.querySelectorAll("li");
- for (const li of listItems) {
- if (li.firstChild) {
- const p = document.createElement("p");
- p.appendChild(li.firstChild.cloneNode());
- li.firstChild.replaceWith(p);
- }
- }
-
const bogus = document.querySelectorAll("[data-mce-bogus]");
for (const element of bogus) {
element.remove();