spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
814 stars 257 forks source link

Issue with tinymce 4.1 and rails 3.2.11 #146

Open nikitasingh opened 10 years ago

nikitasingh commented 10 years ago

Hi,

Earlier we were using tinymce 3.5.6 in our application. However there were some issues and it was not working with IE11. So we upgraded it to latest 4.1 version. However we are still facing one issue where in- -When i first open the editor, it works well. -However when i try to open it again.It do not load and a plain text area is show, without any error in the console.

I found that with rails 4 there were some turbolink issues. Since we are not using rails 4 or gem for turbolink, it seems there is some other problem.

Could someone please help with this??

Thanks, Nikita

nikitasingh commented 10 years ago

After doing whole lot of research I found that there were some code changes in TinyMCE to remove the editor in text areas.

Since we were using ajax calls to make a textarea tinymce editor, we used tinyMCE.execCommand('mceRemoveControl', false, 'some_div'); to remove the tinymce from the text areas, however in tinymce 4 the code is changed to tinyMCE.execCommand('mceRemoveEditor', false, 'some_div');

Due this we were not able to load the tinymce editor again and was forced to refresh the browser again to see the tinymce editor.

Thought to share the it as it might some one else :)

ashlinchak commented 10 years ago

Thanks, your comment helped me. In my case, I'd changed gem version to 4.0.19 and after that correction it worked.

cyzanfar commented 10 years ago

Indeed that did the trick. I'm using rails 4 and had the same problem. Changed the gem version to 4.0.19 at it works like a charm now!

archonic commented 9 years ago

I just finishing narrowing this issue down to between 4.0.19 and 4.0.26, then found this thread. I'm using rails 3.1.10 however, so I don't think it's a Rails issue. I'm also not using turbolinks. I'm also not using tinyMCE.execCommand('mceRemoveControl', false, 'some_div'); or mceRemoveEditor. I can init an editor with the same ID as many times as I want with 4.0.19 but just once with 4.0.26.

I created a ticket here: http://www.tinymce.com/develop/bugtracker_view.php?id=7629. I thought it was an undocumented change with mode: 'exact'.

archonic commented 9 years ago

Ah hah! So implementing tinyMCE.execCommand('mceRemoveEditor', false, 'some_div'); does actually allow me to load that editor again. It may still be an issue with undocumented changes to mode: 'exact'.

archonic commented 9 years ago

I've been told that mode: exact has been deprecated. There's no documentation about it, which they agree is shameful. There is however fallbacks to support mode: exact. I've tried reproducing the multiple "load a template containing the editor" issue (works with 4.0.19 but not with 4.0.26) I described above but it works perfectly with all versions of TinyMCE: http://fiddle.tinymce.com/EUeaab/4

That makes me think it has something to do with the helper in this gem. Anyone else have luck narrowing it down?