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");
78
78
- ** code** Can be set to ```` ``` ```` or ` ~~~ ` . Defaults to ```` ``` ```` .
79
79
- ** italic** Can be set to ` * ` or ` _ ` . Defaults to ` * ` .
80
80
- ** 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 ` .
81
82
- ** hideIcons** : An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
82
83
- ** indentWithTabs** : If set to ` false ` , indent using spaces instead of tabs. Defaults to ` true ` .
83
84
- ** initialValue** : If set, will customize the initial value of the editor.
@@ -120,6 +121,7 @@ var simplemde = new SimpleMDE({
120
121
italic: " _"
121
122
},
122
123
element: document .getElementById (" MyID" ),
124
+ forceSync: true ,
123
125
hideIcons: [" guide" , " heading" ],
124
126
indentWithTabs: false ,
125
127
initialValue: " Hello world!" ,
Original file line number Diff line number Diff line change @@ -1486,6 +1486,13 @@ SimpleMDE.prototype.render = function(el) {
1486
1486
placeholder : options . placeholder || el . getAttribute ( "placeholder" ) || ""
1487
1487
} ) ;
1488
1488
1489
+ if ( options . forceSync === true ) {
1490
+ var cm = this . codemirror ;
1491
+ cm . on ( "change" , function ( ) {
1492
+ cm . save ( ) ;
1493
+ } ) ;
1494
+ }
1495
+
1489
1496
this . gui = { } ;
1490
1497
1491
1498
if ( options . toolbar !== false ) {
You can’t perform that action at this time.
0 commit comments