Provide a onChange callback

This commit is contained in:
anderslemke 2016-09-15 13:55:21 +02:00
parent 666e97e883
commit 57215a836a
2 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,7 @@ simplemde.value("This text will appear in the editor");
- table - table
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`. - **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
- **minHeight**: Sets the minimum height for the composition area, before it starts auto-growing. Should be a string containing a valid CSS value like `"500px"`. Dafaults to `"300px"`. - **minHeight**: Sets the minimum height for the composition area, before it starts auto-growing. Should be a string containing a valid CSS value like `"500px"`. Dafaults to `"300px"`.
- **onChange**: A function that will be called on every change.
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing). - **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`. - **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
- **strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`. - **strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`.

View File

@ -1531,6 +1531,10 @@ SimpleMDE.prototype.render = function(el) {
}); });
} }
if(options.onChange) {
this.codemirror.on("change", options.onChange);
}
this.gui = {}; this.gui = {};
if(options.toolbar !== false) { if(options.toolbar !== false) {