mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +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:
@@ -146,7 +146,7 @@ describe('HTML', () => {
|
||||
});
|
||||
|
||||
expect(html).toBe(
|
||||
'<p>Hello</p><p>World</p>',
|
||||
'<p>Hello</p>\n<p>World</p>',
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user