File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff 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!" ,
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments