[wp-trac] [WordPress Trac] #33393: tinymce plugin wplink throw js TypeError: editor.wp undefined
WordPress Trac
noreply at wordpress.org
Mon Aug 17 19:37:13 UTC 2015
#33393: tinymce plugin wplink throw js TypeError: editor.wp undefined
--------------------------+-----------------------------
Reporter: hauvong | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When TinyMCE initialize with plugin wplink enable but not wordpress, the
wplink js throw TypeError: editor.wp undefined
To reproduce, initialize a new TinyMCE editor with wplink plugins enable.
{{{
tinyMCE.init({
plugins: "wplink"
});
tinyMCE.execCommand( 'mceAddEditor', true, "textarea" )
}}}
To fix, the js should check for wp object exist before calling the
function:
{{{
editor.on( 'preinit', function() {
// editor may not have wp object if tinymce wordpress plugin isn't
loaded.
if ( editor.wp && editor.wp._createToolbar ) {
toolbar = editor.wp._createToolbar( [
'wp_link_preview',
'wp_link_edit',
'wp_link_remove'
], true );
}
} );
}}}
The patch file is attached.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33393>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list