Added in tinymce support #1231

wants to merge 1 commit into


None yet
3 participants

rovermicrover commented Jul 1, 2012

Added in TinyMCE support. Tested with the tinymce-rails gem.

The set up is very simliar to how code-mirror works.

The only major difference is the defaults have to be set like bellow.

window.tinyMCEPreInit = {
  base: options['base'],
  theme: options['theme'],
  suffix: '',
  mode: "specific_textareas"

Also because the jquery version is loaded, two different scripts must be loaded, with the second as a call back, and then the load events as yet another call back for the second script load.

$.getScript options['jspath'], (script, textStatus, jqXHR) =>
  $.getScript options['jqpath'], (script, textStatus, jqXHR) =>

The options are as follows

register_instance_option(:tinymce) do

register_instance_option(:tinymce_js_location) do

register_instance_option(:tinymce_jquery_location) do

register_instance_option(:tinymce_theme_options) do

register_instance_option(:tinymce_options) do

register_instance_option(:tinymce_base_location) do

The theme option is really just the default theme option, and once again because the jquery version is being used two scripts must be loaded, so there are two options for script location.

From what I have been able to test everything seems to work fine, but about every 10th load or so TinyMCE will just refuse to load. I tried forcing a wait to make sure it wasn't an issue with TinyMCE getting called before all the corresponding files where loaded, even with the nested callbacks. But I wasn't able to find the root cause of the issue.

I hope this helps, and let me know if anything is explained poorly or you have any questions.

PS: I also changed the array variable name for each of the editor setups in the coffee script, just to make things clearer.

This pull request fails (merged 5a34643 into e08adbe).


mshibuya commented Jul 4, 2012

I've tested this using Chrome, but TinyMCE doesn't appear in 1 out of 3 forced reloads, every normal reloads and every pjax navigations. Looks like the loading problem still persists.
Can you please fix it?


rovermicrover commented Jul 5, 2012

I will have sometime this weekend to look at it again. When you say "1 out of 3 forced reloads, every normal reloads and every pjax navigations" Do you mean it doesn't works 1/3rd of the time on forced reloads, and none at all on the other two. OR Do you mean that it doesn't works 1/3 of the time no matter how you try to load it?


mshibuya commented Jul 6, 2012

Sorry I didn't make it clear.
After a little further investigation,

  • not shows up in 1 out of 3 forced reloads
  • never shows up with normal reloads
  • with pjax navigations(i.e. clicking the 'edit' link in other pages)
    • when first page load was made by forced reload, works fine until non-pjax page transition occurs
    • when first page load was made by normal reload, never shows up

Is this really working for you?


rovermicrover commented Jul 6, 2012

It was, but I was testing it on my old computer while it was stilling having the issue that lead to this stupid pull request.

What ever was going on caused the above, issue, made it so I couldn't get ember.js to run at all when I tried it out this weekend, and clearly didn't help with this pull request either. And generally made me waste a lot of time that would have other wise been productive.

This weekend or next when I get sometime I am just going to scrap everything and try again from scratch on a new computer, sorry about this I should have noticed quicker that it was a bug on my OS.


rovermicrover commented Jul 17, 2012

Got stuck under a pile of work, still planning on doing this atm, just not right away.


mshibuya commented Apr 25, 2013

Closing this for now.
Please open another one if you come up with a solution!

mshibuya closed this Apr 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment