Skip to content

Commit 911ec9a

Browse files
author
Philipp
committed
2 parents 00bf0b0 + d9df127 commit 911ec9a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ In order to make CodeMirror work correctly, do not forget to start your HTML pag
1414

1515
##### Initialize
1616

17-
`codemirrorOptions` can be `null` or contain original CodeMirror settings
17+
`codemirrorOptions` can be `null` (ignored) or contain original CodeMirror settings
1818

19-
`jqueryCodemirroOptions` can be `null` (ignored)
19+
`jqueryCodemirrorOptions` can be `null` (ignored)
2020

2121
```
2222
$(...).codemirrorInit(codemirrorOptions, jqueryCodemirrorOptions);
@@ -30,7 +30,7 @@ lineNumbers: true,
3030
lineWrapping: true
3131
```
3232

33-
`NB!` Do not forget to add required mode `mode/xml/xml.js`
33+
`NB!` Do not forget to add required CodeMirror mode `mode/xml/xml.js`
3434

3535
`jqueryCodemirrorDefaults` are:
3636

@@ -40,35 +40,39 @@ height: "auto"; (Set in CSS)
4040

4141
Height options are `auto` and `inherit`
4242

43-
When `auto`, CodeMirror container is auto resized. (Container's CSS parameter `height` value should be `auto`! May have `min-height`, should not ave `max-height`)
43+
When `auto`, CodeMirror container is auto resized. (Container's CSS parameter `height` value should be `auto`! May have `min-height`, should not have `max-height`)
4444

4545
When `inherit`, CodeMirror container is not resized, scroll-bar appears. (Container's CSS `height` value should not be `auto`! )
4646

4747

48-
You can set CodeMirror configs in DOM element attribute `codemirror-config` or `codemirror`. Latest is preferred.
48+
You can set CodeMirror configs in DOM element attribute `codemirror-config` or `codemirror` in JSON format. Last one is preferred when both used.
4949

5050
```
5151
<div codemirror='{"autofocus": true, "value": "Hello world"}'></div>
5252
```
5353

54-
You can set plugin configs in DOM element attribute `jquery-codemirror-config` or `jquery-codemirror`. Latest is preferred.
54+
You can set plugin configs in DOM element attribute `jquery-codemirror-config` or `jquery-codemirror` in JSON format. Last one is preferred when both used.
5555

5656
```
5757
<div jquery-codemirror='{"height": "inherit"}'></div>
5858
```
5959

6060
##### CodeMirror methods
6161

62-
CodeMirror object is initialized and saved for each element via `$.data(element, 'codemirror)`
62+
CodeMirror object is initialized and saved for each element via `$.data(element, 'codemirror')`
6363

64-
You can access it and use as specified in CodeMirror manual
64+
You can access it and use as specified in CodeMirror manual (after initialization is done)
6565

6666
```
67+
$(...).codemirrorInit();
6768
$.data($(...)][0], 'codemirror').getValue()
6869
```
6970

70-
Plugin itself adds `setValue(string), getValue(), setOption(option, value), setOptions(optionsObject)`
71+
Plugin itself adds `setValue(string), getValue(), setOption(option, value), setOptions(optionsObject)`. You can access them after initialization is done.
7172

7273
```
73-
$(...).codemirror().getValue()
74+
$(...).codemirrorInit();
75+
$(...).codemirror().getValue();
7476
```
77+
78+
`NB!` Plugin's options (height) cannot be set outside initialization (yet).

0 commit comments

Comments
 (0)