MCPcopy
hub / github.com/streetwriters/notesnook / wrapTablesWithDiv

Function wrapTablesWithDiv

packages/core/src/migrations.ts:625–640  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

623}
624
625function wrapTablesWithDiv(html: string) {
626 const document = parseHTML(html);
627 if (!document) return html;
628 const tables = document.getElementsByTagName("table");
629 for (const table of tables) {
630 table.setAttribute("contenteditable", "true");
631 const div = document.createElement("div");
632 div.setAttribute("contenteditable", "false");
633 div.innerHTML = table.outerHTML;
634 div.classList.add("table-container");
635 table.replaceWith(div);
636 }
637 return "outerHTML" in document
638 ? (document.outerHTML as string)
639 : document.body.innerHTML;
640}
641
642function removeToxClassFromChecklist(html: string): string {
643 const document = parseHTML(html);

Callers 1

migrations.tsFile · 0.85

Calls 6

parseHTMLFunction · 0.90
getElementsByTagNameMethod · 0.80
setAttributeMethod · 0.45
createElementMethod · 0.45
addMethod · 0.45
replaceWithMethod · 0.45

Tested by

no test coverage detected