mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-05-17 21:26:38 +02:00
Add forceSynch option which will autosave to textarea.
Since this is built on CodeMirror I opted to use CodeMirror's save behaviour rather than pulling the value and stomping on the textarea's innerHtml. Fixes #193
This commit is contained in:
parent
71d979ad61
commit
0fb087ca38
|
@ -78,6 +78,7 @@ simplemde.value("This text will appear in the editor");
|
|||
- **code** Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
|
||||
- **italic** Can be set to `*` or `_`. Defaults to `*`.
|
||||
- **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
|
||||
- **forceSynch**: If set to `true`, force changes made in editor to be saved back to original textarea.
|
||||
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
|
||||
- **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
|
||||
- **initialValue**: If set, will customize the initial value of the editor.
|
||||
|
|
16
dist/simplemde.min.js
vendored
16
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1484,6 +1484,13 @@ SimpleMDE.prototype.render = function(el) {
|
|||
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
|
||||
});
|
||||
|
||||
if(options.forceSynch !== false) {
|
||||
var cm = this.codemirror;
|
||||
cm.on("change", function() {
|
||||
cm.save();
|
||||
});
|
||||
}
|
||||
|
||||
this.gui = {};
|
||||
|
||||
if(options.toolbar !== false) {
|
||||
|
|
Loading…
Reference in a new issue