Skip to content

Commit 711af1b

Browse files
committed
Merge pull request sparksuite#264 from NextStepWebs/pr/256
Pull request sparksuite#256 remove conflicts
2 parents 1a79eef + 75b6c82 commit 711af1b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ simplemde.value("This text will appear in the editor");
7878
- **code** Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
7979
- **italic** Can be set to `*` or `_`. Defaults to `*`.
8080
- **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
81+
- **forceSync**: If set to `true`, force text changes made in SimpleMDE to be immediately stored in original textarea. Defaults to `false`.
8182
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
8283
- **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
8384
- **initialValue**: If set, will customize the initial value of the editor.
@@ -120,6 +121,7 @@ var simplemde = new SimpleMDE({
120121
italic: "_"
121122
},
122123
element: document.getElementById("MyID"),
124+
forceSync: true,
123125
hideIcons: ["guide", "heading"],
124126
indentWithTabs: false,
125127
initialValue: "Hello world!",

src/js/simplemde.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,13 @@ SimpleMDE.prototype.render = function(el) {
14861486
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
14871487
});
14881488

1489+
if(options.forceSync === true) {
1490+
var cm = this.codemirror;
1491+
cm.on("change", function() {
1492+
cm.save();
1493+
});
1494+
}
1495+
14891496
this.gui = {};
14901497

14911498
if(options.toolbar !== false) {

0 commit comments

Comments
 (0)