mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Readme: Working with forms
Inserted an example on how to work with forms to keep the textarea automatically up to date with SimpleMDE
This commit is contained in:
parent
e05962d91c
commit
8e192dbb78
19
README.md
19
README.md
@ -57,14 +57,31 @@ var simplemde = new SimpleMDE({ element: $("#MyID")[0] });
|
||||
|
||||
## Get/set the content
|
||||
|
||||
Get the content
|
||||
|
||||
```JavaScript
|
||||
simplemde.value();
|
||||
var val = simplemde.value();
|
||||
```
|
||||
|
||||
Set the content
|
||||
|
||||
```JavaScript
|
||||
simplemde.value("This text will appear in the editor");
|
||||
```
|
||||
|
||||
## Working with forms
|
||||
|
||||
By listening to the `blur` function of codemirror you can ensure, that the value of the underlying textarea in your form always corresponds to the value of your SimpleMDE and vice versa.
|
||||
|
||||
```JavaScript
|
||||
var textarea = $("#MyID");
|
||||
var simplemde = new SimpleMDE({element: textarea[0]});
|
||||
simplemde.value(textarea.text());
|
||||
simplemde.codemirror.on("blur", function() {
|
||||
textarea.text(simplemde.value());
|
||||
});
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
- **autoDownloadFontAwesome**: If set to `true`, force downloads Font Awesome (used for icons). If set to false, prevents downloading. Defaults to `undefined`, which will intelligently check whether Font Awesome has already been included, then download accordingly.
|
||||
|
Loading…
x
Reference in New Issue
Block a user