From 5f46d71af0af216e413af8771f227f2a73deb2ec Mon Sep 17 00:00:00 2001 From: Dan Brown <ssddanbrown@googlemail.com> Date: Sun, 15 Sep 2024 16:10:46 +0100 Subject: [PATCH] Lexical: Fixed a range of issues in RTL mode --- resources/js/components/wysiwyg-editor.js | 2 ++ resources/js/wysiwyg/index.ts | 5 +++++ resources/js/wysiwyg/todo.md | 4 ++-- resources/sass/_editor.scss | 9 ++++++++- resources/sass/_pages.scss | 2 -- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/resources/js/components/wysiwyg-editor.js b/resources/js/components/wysiwyg-editor.js index ebc142e2a..eed1c6155 100644 --- a/resources/js/components/wysiwyg-editor.js +++ b/resources/js/components/wysiwyg-editor.js @@ -15,6 +15,8 @@ export class WysiwygEditor extends Component { this.editor = wysiwyg.createPageEditorInstance(this.editContainer, editorContent, { drawioUrl: this.getDrawIoUrl(), pageId: Number(this.$opts.pageId), + darkMode: document.documentElement.classList.contains('dark-mode'), + textDirection: this.$opts.textDirection, translations: { imageUploadErrorText: this.$opts.imageUploadErrorText, serverUploadLimitText: this.$opts.serverUploadLimitText, diff --git a/resources/js/wysiwyg/index.ts b/resources/js/wysiwyg/index.ts index c5dd151af..c4403773b 100644 --- a/resources/js/wysiwyg/index.ts +++ b/resources/js/wysiwyg/index.ts @@ -42,8 +42,13 @@ export function createPageEditorInstance(container: HTMLElement, htmlContent: st const editWrap = el('div', { class: 'editor-content-wrap', }, [editArea]); + container.append(editWrap); container.classList.add('editor-container'); + container.setAttribute('dir', options.textDirection); + if (options.darkMode) { + container.classList.add('editor-dark'); + } const editor = createEditor(config); editor.setRootElement(editArea); diff --git a/resources/js/wysiwyg/todo.md b/resources/js/wysiwyg/todo.md index 2662350af..874ac537f 100644 --- a/resources/js/wysiwyg/todo.md +++ b/resources/js/wysiwyg/todo.md @@ -2,12 +2,12 @@ ## In progress -// +- RTL/LTR support ## Main Todo - Mac: Shortcut support via command. -- RTL/LTR support +- Translations ## Secondary Todo diff --git a/resources/sass/_editor.scss b/resources/sass/_editor.scss index 61a9f2de0..dd1e1a2c3 100644 --- a/resources/sass/_editor.scss +++ b/resources/sass/_editor.scss @@ -96,6 +96,9 @@ body.editor-is-fullscreen { fill: #888; } } +.editor-container[dir="rtl"] .editor-menu-button-icon { + rotate: 180deg; +} .editor-button-with-menu-container { display: flex; flex-direction: row; @@ -171,6 +174,9 @@ body.editor-is-fullscreen { background-position: 98% 50%; background-size: 28px; } +.editor-container[dir="rtl"] .editor-format-menu-toggle { + background-position: 2% 50%; +} .editor-format-menu .editor-dropdown-menu { min-width: 300px; .editor-dropdown-menu { @@ -324,9 +330,10 @@ body.editor-is-fullscreen { .editor-node-resizer { position: absolute; left: 0; - right: 0; + right: auto; display: inline-block; outline: 2px dashed var(--editor-color-primary); + direction: ltr; } .editor-node-resizer-handle { position: absolute; diff --git a/resources/sass/_pages.scss b/resources/sass/_pages.scss index ca59c85ca..6e6f7bb7e 100755 --- a/resources/sass/_pages.scss +++ b/resources/sass/_pages.scss @@ -2,13 +2,11 @@ display: flex; flex-direction: column; align-items: stretch; - overflow: hidden; .edit-area { flex: 1; flex-direction: column; z-index: 10; - overflow: hidden; border-radius: 0 0 8px 8px; }