Bug #5510

3.5.7 update broke mceRemoveControl / mceAddControl.

2012-09-20 21:54:41 By: drumsibumsi
firefox msie safari chrome opera
Closed Priority: 3 Resolution: Fixed Assigned to: None
Description of problem:
Cannot dynamically hide and show TinyMCE instance while manipulating DOM (changing parents or swapping TinyMCE).

Steps to reproduce:
1. Execute:
tinyMCE.execCommand("mceRemoveControl", false, '_id_of_tinymce_instance_');
tinyMCE.execCommand('mceAddControl', false, '_id_of_tinymce_instance_');

Expected result:
TinyMCE instance should become re-initialized again.

Actual result:
Actual TEXTAREA hidden, TinyMCE instance not shown.

Comment: This worked in version 3.5.6 and before.

I see the problem now. It's because of commit e0378ceb7792fb7949c3aca3487306a78668595e at github. You have put "hide()" on a timeout in javascript, but that's totally wrong, because I do hide TinyMCE instance, do some DOM manipulations (like I described above) and show it back. What does the timeout do? It postpones the actual hiding to the moment when I already requested TinyMCE to show up again. Please find better way than putting something on timeout. It breaks the logic. And even if I put my "show" function on a timeout, it flickers because of timeout.


If you wish to follow or post a comment, you need to be registered and logged in.


User Image
  • 2012-09-20 22:18:30


Not reproducible. Could you set up a fiddle to share?

User Image
  • 2012-09-20 22:37:58



Try 3.5.7 version and then - 3.5.6. The older one works while the newest fails.

User Image
  • 2012-09-20 22:44:12



-- And here you can see the flickering when clicking "TEST!!!". This I talked about in my first post. I used Firefox 15 for these examples.

User Image
  • 2012-09-20 22:46:39


The second example actually is here: http://fiddle.tinymce.com/agcaab/1

User Image
  • 2012-09-21 08:15:36


Why do you need to re-initialize the editor this way?

The timeout is for a IE9 crash users reported. Might roll that fix back since I'm a bit allergic to timeouts.

User Image
  • 2012-09-21 09:13:23


I too hate timeout solutions in javascripts. I dynamically create instances, move them around (swap), remove them, etc. In simple scenario I just need to swap two TinyMCEs. Since I cannot simply change parents of initialized TinyMCEs (they hang up), so (as suggested in many forums) I deactivate first, move around, re-initialize.

Now there is an inconsistence. If you put "hiding" on a Timeout, then, "showing" also should be put on a Timeout. At least that. But unfortunately even this solution is not acceptable for me, because it flickers like hell.

User Image
  • 2012-09-21 09:37:16


Rewrote the logic a bit so it doesn't hide the container on remove.

This bug is related to #4921

User Image
  • 2012-09-21 10:10:39


Thank you very much! That was fast and worked also!!!