1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Lexical: Source code input changes

- Increased default source code view size.
- Updated HTML generation to output each top-level block on its own
  line.
This commit is contained in:
Dan Brown
2025-07-24 17:24:59 +01:00
parent ae4d1d804a
commit 865e5aecc9
5 changed files with 41 additions and 22 deletions

View File

@@ -85,7 +85,18 @@ export function $generateHtmlFromNodes(
$appendNodesToHTML(editor, topLevelNode, container, selection);
}
return container.innerHTML;
const nodeCode = [];
for (const node of container.childNodes) {
if ("outerHTML" in node) {
nodeCode.push(node.outerHTML)
} else {
const wrap = document.createElement('div');
wrap.appendChild(node.cloneNode(true));
nodeCode.push(wrap.innerHTML);
}
}
return nodeCode.join('\n');
}
function $appendNodesToHTML(