Ionaru / Ionaru/easy-markdown-editor

Preview ignores the direction passed to CodeMirror, and uses the surrounding direction

Open
#425 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
3.1k
Forks
363
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Even though I've passed `direction: rtl` to the options, the preview ignores this option. Instead it always follows the surrounding direction.

**To Reproduce**
Steps to reproduce the behavior:
1. Pass `direction: rtl` into the configuration
2. Toggle the body `dir` attribute between `ltr` and `rtl`
3. The editor correctly respects the CodeMirror option, but the preview does not

**Expected behavior**
Preview should also respect the CodeMirror option

**Screenshots**
![image](https://user-images.githubusercontent.com/312166/167747128-00a6f7f1-a41c-4e93-8314-7926523e5147.png)

![preview ignores CodeMirror direction](https://user-images.githubusercontent.com/312166/167747918-bc0d7cb4-baa9-4dc3-a76a-d902ad9ee6fd.gif)

In the editor the Hebrew word is on the right while "HTML" is on the left, whether the body direction is `ltr` or `rtl`. But this changes in the preview, based on the `body` `dir` attribute.

**Version information**
- OS: Windows
- Browser: Edge 97 (via WebView2 control)
- EasyMDE version: [e.g. 2.16.1]

**Additional information**
It may just be a matter of setting `direction` on the `.editor-preview` CSS rule.

```css
.editor-preview {
direction: rtl;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.