bootstrap-markdown-editor icon indicating copy to clipboard operation
bootstrap-markdown-editor copied to clipboard

Given methods not working

Open divyanshu707 opened this issue 9 years ago • 2 comments

Hi @inacho $('#myEditor').markdownEditor('content'); => returns "" even though I have content in editor $('#myEditor').markdownEditor('setContent','abcdef') => not working Please help in fixing.

Thanks

divyanshu707 avatar Oct 24 '16 14:10 divyanshu707

this could be a dupe of #24 and I have the same issue

jstaerk avatar Jan 03 '17 13:01 jstaerk

Both methods fail to find the element they are after. They need to go one step up through parent:

content: function () {
    var editor = ace.edit(this.find('.md-editor')[0]);
    return editor.getSession().getValue();
},
setContent: function(str) {
     var editor = ace.edit(this.find('.md-editor')[0]);
     editor.setValue(str, 1);
}

Shoud be

content: function () {
    var editor = ace.edit(this.parent().find('.md-editor')[0]);
    return editor.getSession().getValue();
},
setContent: function(str) {
     var editor = ace.edit(this.parent().find('.md-editor')[0]);
     editor.setValue(str, 1);
}

mfurseroberts avatar Jul 02 '18 13:07 mfurseroberts