1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-24 03:42:32 +01:00

fix(wysiwyg): preserves line feeds in code block mode

This commit is contained in:
julesdevops 2022-02-05 10:17:13 +01:00
parent 9d15688a43
commit 049d6ba5b2

View File

@ -136,7 +136,7 @@ function codePlugin() {
const selectedNode = editor.selection.getNode();
if (!elemIsCodeBlock(selectedNode)) {
const providedCode = editor.selection.getNode().textContent;
const providedCode = editor.selection.getNode().innerText;
window.components.first('code-editor').open(providedCode, '', (code, lang) => {
const wrap = document.createElement('div');
wrap.innerHTML = `<pre><code class="language-${lang}"></code></pre>`;