mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: do not touch lists during migration
This commit is contained in:
@@ -94,12 +94,17 @@ function decodeWrappedTableHtml(html) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function tinyToTiptap(html) {
|
export function tinyToTiptap(html) {
|
||||||
|
if (typeof html !== "string") return html;
|
||||||
|
|
||||||
const document = parseHTML(html);
|
const document = parseHTML(html);
|
||||||
|
|
||||||
const tables = document.querySelectorAll("table");
|
const tables = document.querySelectorAll("table");
|
||||||
for (const table of tables) {
|
for (const table of tables) {
|
||||||
table.removeAttribute("contenteditable");
|
table.removeAttribute("contenteditable");
|
||||||
if (table.parentElement?.nodeName.toLowerCase() === "div") {
|
if (
|
||||||
|
table.parentElement &&
|
||||||
|
table.parentElement.nodeName.toLowerCase() === "div"
|
||||||
|
) {
|
||||||
table.parentElement.replaceWith(table);
|
table.parentElement.replaceWith(table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,15 +124,6 @@ export function tinyToTiptap(html) {
|
|||||||
if (!p.childNodes.length) p.remove();
|
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]");
|
const bogus = document.querySelectorAll("[data-mce-bogus]");
|
||||||
for (const element of bogus) {
|
for (const element of bogus) {
|
||||||
element.remove();
|
element.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user