bootstrap-wysihtml5-rails icon indicating copy to clipboard operation
bootstrap-wysihtml5-rails copied to clipboard

set dynamic content inside editor

Open vincentli99 opened this issue 8 years ago • 2 comments

Thank you for offering this good gem! I had a difficulty to set dynamic content within the editor. It is not simple like $('#textarea').html("updated content"). Finally I found a great solution from: https://www.codementor.io/tips/0643978211/update-wysihtml5-editor-content-dynamically-using-jquery That is: $('#textarea-id').data("wysihtml5").editor.setValue('new content'); Is it possible to put it in the readme doc? I believe it will help many developers. Thank you!

vincentli99 avatar Aug 14 '16 14:08 vincentli99

Sure, feel free to make a Pull Request with this change and I will merge it.

Nerian avatar Nov 18 '16 13:11 Nerian

I'm actually having trouble with that. Not sure if that actually works.

$('#backlogEditModal textarea[name="description"]').wysihtml5({  image:false });
......
$('#backlogEditModal textarea[name="description"]').data("wysihtml5").editor.setValue(data.description);

Gives me

Uncaught TypeError: Cannot read property 'setValue' of undefined

jhourlad avatar Apr 16 '17 09:04 jhourlad