mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-29 22:29:57 +00:00
WYSIWYG: Updated code handling to respect direction
Specifically supports "dir" attribute being on top level "pre" element, and handles application/switching of this within the editor. For #4809
This commit is contained in:
parent
9ff9b9c805
commit
999d41a7f5
4 changed files with 23 additions and 6 deletions
resources/js/code
|
@ -1,4 +1,4 @@
|
|||
import {EditorView, keymap} from '@codemirror/view';
|
||||
import {EditorView, keymap, Direction} from '@codemirror/view';
|
||||
|
||||
import {copyTextToClipboard} from '../services/clipboard';
|
||||
import {viewerExtensions, editorExtensions} from './setups';
|
||||
|
@ -55,6 +55,11 @@ function highlightElem(elem) {
|
|||
const wrapper = document.createElement('div');
|
||||
elem.parentNode.insertBefore(wrapper, elem);
|
||||
|
||||
const direction = innerCodeElem.getAttribute('dir') || elem.getAttribute('dir') || '';
|
||||
if (direction) {
|
||||
wrapper.setAttribute('dir', direction);
|
||||
}
|
||||
|
||||
const ev = createView('content-code-block', {
|
||||
parent: wrapper,
|
||||
doc: content,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue