inherit
14706
0
Jan 28, 2021 15:41:20 GMT -8
Xikeon
170
October 2003
mikeo
|
Post by Xikeon on Nov 9, 2012 9:15:05 GMT -8
What's the best way to control the WYSIWYG editor? For the Post Templates I wanted to add content to the editor and I found the event 'setContent' in the source, but I have to add it to a timeout (even after document ready) for it to work.
Is there a better way to set the content for the editor?
$(function () { if( proboards.data('route').name == 'new_thread' ) { setTimeout( function() { $('textarea[name="message"]').wysiwyg( 'setContent', '<b>test</b> test' ); }, 100); } });
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 9, 2012 16:00:06 GMT -8
We would need a custom event added in via ProBoards, as the visual editor is dynamically built. The "ready" event is working correctly, as the DOM has loaded, but not with the visual editor at the time the event is fired.
For now, you would have to use a "load" event, or create a custom function to watch for it.
|
|
inherit
14706
0
Jan 28, 2021 15:41:20 GMT -8
Xikeon
170
October 2003
mikeo
|
Post by Xikeon on Nov 10, 2012 0:48:21 GMT -8
Yea, what I was hoping for that the visual editor would run on DOM ready and pick up the changes I would make to the textarea (as I believe, out of the top of my head, the wysiwyg runs at the end of the page). But that didn't happen sadly . Thanks for the input, I'm going to see what I can work out.
|
|