Alex
Alex

Reputation: 68084

disable TinyMCE controls in the background

Oh hai

I have an ajax request, which works way:

The problem is that for 1-2 seconds I'm seeing the editor controls being removed, then added again when the ajax completes.

Is there any way I could avoid this? By removing the editor somehow in the background for example?

I tried leaving out tinyMCE.execCommand('mceRemoveControl', false, editor); before the ajax starts, but then I can't get the editor back... Which is kind of weird because the text area gets replaced. It seems that tinyMCE stays in memory somehow or something

Upvotes: 2

Views: 346

Answers (2)

Thariama
Thariama

Reputation: 50840

It seems that tinyMCE stays in memory somehow or something

Yes, this is true. The tinyMCE object keeps track of all editor instances that have been created. When an editor gets reinitialized with the same id you will get into trouble. that's the reason why you need to shut down tinymce instances correctly.

I see another option. You do not need to replace the textarea. Why don't you just reset the tinymce editor content?

Upvotes: 2

Bharat Gaikwad
Bharat Gaikwad

Reputation: 530

setTimeout... may solve that problem...

window.setTimeout(function(){ tinyMCE.execCommand('mceFocus', false, 'editor');}, 500);

Upvotes: 1

Related Questions