Skip to content

Commit 6a0e262

Browse files
committed
Fixed a bug that caused some Obsidian editing behaviors to not work
1 parent 0366767 commit 6a0e262

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ If you want to forget the text direction of a file and go back to using the defa
4242

4343
## Changelog
4444

45+
### 0.0.8
46+
47+
- Fixed a bug in the previous release, of some important Obsidian editing behavior (e.g. auto-complete list bullets) being overwritten.
48+
4549
### 0.0.7
4650

4751
- Improved the handling of the Home & End keys (without Shift at this point) in RTL. It's still not perfect (CodeMirror is not good at this) but at least the basic functionality works.

main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ export default class RtlPlugin extends Plugin {
6666

6767
this.registerCodeMirror((cm: CodeMirror.Editor) => {
6868
let cmEditor = cm;
69-
cmEditor.setOption('extraKeys', {
70-
'End': (cm) => {
69+
let currentExtraKeys = cmEditor.getOption('extraKeys');
70+
let moreKeys = {
71+
'End': (cm: CodeMirror.Editor) => {
7172
if (cm.getOption('direction') == 'rtl') {
7273
let editor = this.getObsidianEditor();
7374
let pos = editor.getCursor();
@@ -78,7 +79,7 @@ export default class RtlPlugin extends Plugin {
7879
else
7980
cm.execCommand('goLineEnd');
8081
},
81-
'Home': (cm) => {
82+
'Home': (cm: CodeMirror.Editor) => {
8283
if (cm.getOption('direction') == 'rtl') {
8384
let editor = this.getObsidianEditor();
8485
let pos = editor.getCursor();
@@ -89,7 +90,8 @@ export default class RtlPlugin extends Plugin {
8990
else
9091
cm.execCommand('goLineStartSmart');
9192
}
92-
});
93+
};
94+
cmEditor.setOption('extraKeys', Object.assign({}, currentExtraKeys, moreKeys));
9395
});
9496

9597
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "obsidian-rtl",
33
"name": "RTL Support",
4-
"version": "0.0.7",
4+
"version": "0.0.8",
55
"description": "Right to Left (RTL) text direction support for languages like Arabic, Hebrew and Farsi.",
66
"author": "esm",
77
"authorUrl": "",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-rtl",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "RTL (Right to Left) language support for Obsidian.",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)