Closed samhagman closed 8 years ago
I use a command that update the chunk with the new value:
var newString = 'new **markdown** value';
editor.runCommand(function(chunks, mode) {
chunks.after='';
if (mode == 'html') {
chunks.before = editor.parseMarkdown(newString);
} else {
chunks.before = newString;
}
});
Perhaps this should be integrated into the editor.value()
method -- that way value('new **markdown** value')
could be used as a setter and a getter. I would be happy to open a pull request for this as it seems a very common thing to want to do and an easy addition.
Sounds good to me
I seemed to be able to make a simpler fix which added a setter ability to the value()
method; see #27.
@jywarren Awesome, I'll close this when that gets merged, thank you for your efforts!
4.1.0
The way I picture this working is a function being added to the editor object like
editor.setValue(markdownString)
.This would internally check
editor.mode
and then either just insert the markdownString into the editor (if in markdown mode) or runeditor.parseMarkdown(markdownString)
and then either render or insert the resulting HTML string into the editor (if in html or wysiwyg mode respectively).It also wouldn't hurt to make this an option to pass into the
woofmark()
function with a name likeoption.initialValue
or something.P.S. Thanks for this great extensible library.