Reputation: 6830
When I use setContent
on a TinyMCE editor, it sets the focus to that editor control.
var te = tinymce.get('my_id');
te.setContent('new contents');
Any way to prevent this?
Upvotes: 3
Views: 1681
Reputation: 140210
Looking at the source code (I haven't used tinymce), I cannot find anything that would set the focus but there are some events that are fired so I think this is worth giving a shot:
te.setContent( 'new contents', { no_events: true } );
Upvotes: 6
Reputation: 6830
My current workaround:
Using jQuery:
var scrollTop = $(document).scrollTop();
// setContent stuff...
$(this).focus();
$(document).scrollTop(scrollTop);
Upvotes: 1