Skip to content

Commit c465138

Browse files
committed
Add new options and export more functions
1 parent a599705 commit c465138

File tree

2 files changed

+132
-73
lines changed

2 files changed

+132
-73
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,13 @@ let jar = CodeJar(editor, highlight)
5353
Third argument to `CodeJar` is options:
5454
- `tab: string` replaces "tabs" with given string. Default: `\t`.
5555
- Note: use css rule `tab-size` to customize size.
56-
- `indentOn: RegExp` allows auto indent rule to be customized. Default `{$`
56+
- `indentOn: RegExp` allows auto indent rule to be customized. Default `{$`.
5757
- Auto-tab if the text before cursor match the given regex while pressing Enter.
58-
- `spellcheck: boolean` enables spellchecking on the editor. Default `false`
59-
- `addClosing: boolean` automatically adds closing brackets, quotes. Default `true`
58+
- `spellcheck: boolean` enables spellchecking on the editor. Default `false`.
59+
- `catchTab: boolean` catches Tab keypress events and replaces it with `tab` string. Default: `true`.
60+
- `preserveIdent: boolean` keeps indent levels on new line. Default `true`.
61+
- `addClosing: boolean` automatically adds closing brackets, quotes. Default `true`.
62+
- `history` records history. Default `true`.
6063

6164

6265
```js
@@ -122,6 +125,26 @@ Return current code.
122125
let code = jar.toString()
123126
```
124127

128+
#### `save(): string`
129+
130+
Saves current cursor position.
131+
132+
```js
133+
let pos = jar.save()
134+
```
135+
136+
#### `restore(pos: Position)`
137+
138+
Restore cursor position.
139+
140+
```js
141+
jar.restore(pos)
142+
```
143+
144+
#### `recordHistory()`
145+
146+
Saves current editor state to history.
147+
125148
#### `destroy()`
126149

127150
Removes event listeners from editor.

0 commit comments

Comments
 (0)