mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-10-08 05:27:00 -06:00
Pass through mode options
This commit is contained in:
parent
98aa67881d
commit
cc192744b8
@ -83,6 +83,7 @@ simplemde.value("This text will appear in the editor");
|
|||||||
- **unique_id**: You must set a unique identifier so that SimpleMDE can autosave. Something that separates this from other textareas.
|
- **unique_id**: You must set a unique identifier so that SimpleMDE can autosave. Something that separates this from other textareas.
|
||||||
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
|
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
|
||||||
- **previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
|
- **previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
|
||||||
|
- **codeMirrorModeConfig**: Additional CodeMirror config options to pass through to gfm and markdown modes.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
var simplemde = new SimpleMDE({
|
var simplemde = new SimpleMDE({
|
||||||
@ -113,6 +114,9 @@ var simplemde = new SimpleMDE({
|
|||||||
}, 250);
|
}, 250);
|
||||||
|
|
||||||
return "Loading...";
|
return "Loading...";
|
||||||
|
},
|
||||||
|
codeMirrorModeConfig: {
|
||||||
|
highlightFormatting: true, taskLists: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -755,6 +755,8 @@ function SimpleMDE(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.codeMirrorModeConfig = options.codeMirrorModeConfig || {};
|
||||||
|
|
||||||
// Update this options
|
// Update this options
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
@ -830,12 +832,14 @@ SimpleMDE.prototype.render = function(el) {
|
|||||||
if(cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
if(cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
||||||
};
|
};
|
||||||
|
|
||||||
var mode = "spell-checker";
|
var mode, backdrop;
|
||||||
var backdrop = "gfm";
|
|
||||||
|
|
||||||
if(options.spellChecker === false) {
|
if(options.spellChecker === false) {
|
||||||
mode = "gfm";
|
mode = options.codeMirrorModeConfig;
|
||||||
backdrop = undefined;
|
mode.name = 'gfm';
|
||||||
|
} else {
|
||||||
|
mode = 'spell-checker';
|
||||||
|
backdrop = options.codeMirrorModeConfig;
|
||||||
|
backdrop.name = 'gfm';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.codemirror = CodeMirror.fromTextArea(el, {
|
this.codemirror = CodeMirror.fromTextArea(el, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user