bootstrap-wysihtml5-rails
bootstrap-wysihtml5-rails copied to clipboard
set dynamic content inside editor
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!
Sure, feel free to make a Pull Request with this change and I will merge it.
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