Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#20181 closed defect (bug) (invalid)

tinyMCE script looks for a /simple theme that does not exist

Reported by: helgatheviking Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: TinyMCE Keywords:
Focuses: Cc:


wp-includes/js/tinymce/tiny_mce.js seems to reference a "simple" theme that does not exist in the wp-includes/js/tinymce/themes folder

i noticed this when trying to apply tinyMCE to some textareas in metaboxes. normally i copy the tinyMCE.settings object but I made an error that had my script execute before that object was defined and I got the following error:

http://localhost/multi/wp-includes/js/tinymce/wp-tinymce.php?c=1&ver=348-20056 line 2

Failed to load: http://localhost/multi/wp-includes/js/tinymce/themes/simple/editor_template.js

Change History (7)

#1 @azaozz
10 years ago

  • Component changed from General to TinyMCE
  • Keywords close added

If TinyMCE is trying to load the "simple" theme that means it's not initialized properly. Yes, by default it includes a simple theme however that has never been used in WordPress as it doesn't allow any customizations, plugins, etc. (also the buttons are at the bottom which makes it quite confusing for the users).

#2 @needle
9 years ago

I've come across the same reference to the non-existent file when using wp_editor() in a theme to provide TinyMCE for the comment textarea. Perhaps the following might help untangle what happens in cases like this.

It took me a while to understand what was going on, because two identical installs exhibited different behaviours; ie, one loaded TinyMCE correctly, the other failed and referenced the non-existent file wp-includes/js/tinymce/themes/simple/editor_template.js.

It turned out that wp_default_editor() (called from line 555 of class-wp-editor.php) was returning the "currently active" editor in the post edit screen. In one install, my user had selected the HTML tab to edit a post, and therefore TinyMCE never loaded for the wp_editor() instance in the comment textarea. Nor was there a fallback because I had set 'quicktags' => false.

So, if you've set 'quicktags' => false in your wp_editor() settings for your metabox and you've got HTML as your currently active editor for the post, you might well see TinyMCE fail to load. My solution was to use the wp_default_editor filter to return 'tinymce' for my instance.

Hope that helps.

#3 @jethin
9 years ago

This was a very annoying and difficult to troubleshoot bug. Needle's description fit my case exactly and his/her solution worked well for me. (Thanks Needle!) The complete filter call I used to reset the editor mode was:

add_filter('wp_default_editor', create_function('', 'return "tinymce";'));
Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#4 @SergeyBiryukov
9 years ago

  • Keywords close removed

#5 follow-up: @SergeyBiryukov
9 years ago

FWIW, I don't see a reference to the "simple" theme in TinyMCE 3.5.6 (updated in [21545]).

#6 in reply to: ↑ 5 @needle
9 years ago

Replying to SergeyBiryukov:

FWIW, I don't see a reference to the "simple" theme in TinyMCE 3.5.6 (updated in [21545]).

Running everything under SVN latest (without the filter) confirms your observation here. The TinyMCE editor is now loading with a default theme instead of throwing the above error (when the HTML editor is selected in the post edit screen). It's not as pretty, though, so the filter's usefulness stands.

Thanks for the heads-up on this.

Last edited 9 years ago by needle (previous) (diff)

#7 @nacin
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.