Skip to content

Commit

Permalink
Add new options and export more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Jan 31, 2021
1 parent a599705 commit c465138
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 73 deletions.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ let jar = CodeJar(editor, highlight)
Third argument to `CodeJar` is options:
- `tab: string` replaces "tabs" with given string. Default: `\t`.
- Note: use css rule `tab-size` to customize size.
- `indentOn: RegExp` allows auto indent rule to be customized. Default `{$`
- `indentOn: RegExp` allows auto indent rule to be customized. Default `{$`.
- Auto-tab if the text before cursor match the given regex while pressing Enter.
- `spellcheck: boolean` enables spellchecking on the editor. Default `false`
- `addClosing: boolean` automatically adds closing brackets, quotes. Default `true`
- `spellcheck: boolean` enables spellchecking on the editor. Default `false`.
- `catchTab: boolean` catches Tab keypress events and replaces it with `tab` string. Default: `true`.
- `preserveIdent: boolean` keeps indent levels on new line. Default `true`.
- `addClosing: boolean` automatically adds closing brackets, quotes. Default `true`.
- `history` records history. Default `true`.


```js
Expand Down Expand Up @@ -122,6 +125,26 @@ Return current code.
let code = jar.toString()
```

#### `save(): string`

Saves current cursor position.

```js
let pos = jar.save()
```

#### `restore(pos: Position)`

Restore cursor position.

```js
jar.restore(pos)
```

#### `recordHistory()`

Saves current editor state to history.

#### `destroy()`

Removes event listeners from editor.
Expand Down
Loading

0 comments on commit c465138

Please sign in to comment.