mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06: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
d40a767443
commit
6ab6715484
@ -77,6 +77,7 @@ simplemde.value("This text will appear in the editor");
|
|||||||
- **bold** Can be set to `**` or `__`. Defaults to `**`.
|
- **bold** Can be set to `**` or `__`. Defaults to `**`.
|
||||||
- **italic** 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.
|
- **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.
|
- **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`.
|
- **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.
|
- **initialValue**: If set, will customize the initial value of the editor.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* simplemde v1.10.0
|
* simplemde v1.11.0
|
||||||
* Copyright Next Step Webs, Inc.
|
* Copyright Next Step Webs, Inc.
|
||||||
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
|
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
|
||||||
* @license MIT
|
* @license MIT
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* simplemde v1.10.0
|
* simplemde v1.11.0
|
||||||
* Copyright Next Step Webs, Inc.
|
* Copyright Next Step Webs, Inc.
|
||||||
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
|
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
|
||||||
* @license MIT
|
* @license MIT
|
||||||
@ -14060,6 +14060,13 @@ SimpleMDE.prototype.render = function(el) {
|
|||||||
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
|
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(options.forceSynch !== false) {
|
||||||
|
var cm = this.codemirror;
|
||||||
|
cm.on("change", function() {
|
||||||
|
cm.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(options.toolbar !== false) {
|
if(options.toolbar !== false) {
|
||||||
this.createToolbar();
|
this.createToolbar();
|
||||||
}
|
}
|
||||||
|
4
dist/simplemde.min.css
vendored
4
dist/simplemde.min.css
vendored
File diff suppressed because one or more lines are too long
18
dist/simplemde.min.js
vendored
18
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "simplemde",
|
"name": "simplemde",
|
||||||
"version": "1.10.0",
|
"version": "1.11.0",
|
||||||
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
|
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"embeddable",
|
"embeddable",
|
||||||
|
@ -1172,6 +1172,13 @@ SimpleMDE.prototype.render = function(el) {
|
|||||||
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
|
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(options.forceSynch !== false) {
|
||||||
|
var cm = this.codemirror;
|
||||||
|
cm.on("change", function() {
|
||||||
|
cm.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(options.toolbar !== false) {
|
if(options.toolbar !== false) {
|
||||||
this.createToolbar();
|
this.createToolbar();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user