Skip to content

Commit 5f46d71

Browse files
committed
Lexical: Fixed a range of issues in RTL mode
1 parent 6872eb8 commit 5f46d71

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

resources/js/components/wysiwyg-editor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export class WysiwygEditor extends Component {
1515
this.editor = wysiwyg.createPageEditorInstance(this.editContainer, editorContent, {
1616
drawioUrl: this.getDrawIoUrl(),
1717
pageId: Number(this.$opts.pageId),
18+
darkMode: document.documentElement.classList.contains('dark-mode'),
19+
textDirection: this.$opts.textDirection,
1820
translations: {
1921
imageUploadErrorText: this.$opts.imageUploadErrorText,
2022
serverUploadLimitText: this.$opts.serverUploadLimitText,

resources/js/wysiwyg/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ export function createPageEditorInstance(container: HTMLElement, htmlContent: st
4242
const editWrap = el('div', {
4343
class: 'editor-content-wrap',
4444
}, [editArea]);
45+
4546
container.append(editWrap);
4647
container.classList.add('editor-container');
48+
container.setAttribute('dir', options.textDirection);
49+
if (options.darkMode) {
50+
container.classList.add('editor-dark');
51+
}
4752

4853
const editor = createEditor(config);
4954
editor.setRootElement(editArea);

resources/js/wysiwyg/todo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
## In progress
44

5-
//
5+
- RTL/LTR support
66

77
## Main Todo
88

99
- Mac: Shortcut support via command.
10-
- RTL/LTR support
10+
- Translations
1111

1212
## Secondary Todo
1313

resources/sass/_editor.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ body.editor-is-fullscreen {
9696
fill: #888;
9797
}
9898
}
99+
.editor-container[dir="rtl"] .editor-menu-button-icon {
100+
rotate: 180deg;
101+
}
99102
.editor-button-with-menu-container {
100103
display: flex;
101104
flex-direction: row;
@@ -171,6 +174,9 @@ body.editor-is-fullscreen {
171174
background-position: 98% 50%;
172175
background-size: 28px;
173176
}
177+
.editor-container[dir="rtl"] .editor-format-menu-toggle {
178+
background-position: 2% 50%;
179+
}
174180
.editor-format-menu .editor-dropdown-menu {
175181
min-width: 300px;
176182
.editor-dropdown-menu {
@@ -324,9 +330,10 @@ body.editor-is-fullscreen {
324330
.editor-node-resizer {
325331
position: absolute;
326332
left: 0;
327-
right: 0;
333+
right: auto;
328334
display: inline-block;
329335
outline: 2px dashed var(--editor-color-primary);
336+
direction: ltr;
330337
}
331338
.editor-node-resizer-handle {
332339
position: absolute;

resources/sass/_pages.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
display: flex;
33
flex-direction: column;
44
align-items: stretch;
5-
overflow: hidden;
65

76
.edit-area {
87
flex: 1;
98
flex-direction: column;
109
z-index: 10;
11-
overflow: hidden;
1210
border-radius: 0 0 8px 8px;
1311
}
1412

0 commit comments

Comments
 (0)