X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/968bc8cdf354d9cbe29b88abdc747a7845031fab..refs/pull/4955/head:/resources/js/wysiwyg/plugin-codeeditor.js diff --git a/resources/js/wysiwyg/plugin-codeeditor.js b/resources/js/wysiwyg/plugin-codeeditor.js index 2fe2ac26a..f86760214 100644 --- a/resources/js/wysiwyg/plugin-codeeditor.js +++ b/resources/js/wysiwyg/plugin-codeeditor.js @@ -205,6 +205,11 @@ function register(editor) { contenteditable: 'false', }); + const direction = el.attr('dir'); + if (direction) { + wrapper.attr('dir', direction); + } + const spans = el.getAll('span'); for (const span of spans) { span.unwrap(); @@ -222,6 +227,13 @@ function register(editor) { editor.serializer.addNodeFilter('code-block', elms => { for (const el of elms) { + const direction = el.attr('dir'); + if (direction && el.firstChild) { + el.firstChild.attr('dir', direction); + } else if (el.firstChild) { + el.firstChild.attr('dir', null); + } + el.unwrap(); } });