Opened 11 years ago
Closed 11 years ago
#33393 closed defect (bug) (fixed)
tinymce plugin wplink throw js TypeError: editor.wp undefined
| Reported by: | hauvong | Owned by: | azaozz |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3.1 |
| Component: | TinyMCE | Version: | 4.3 |
| Severity: | normal | Keywords: | has-patch fixed-major |
| Cc: | Focuses: |
Description
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.
Attachments (1)
Change History (12)
#1
follow-up:
↓ 2
@
11 years ago
- Keywords reporter-feedback added
- Version trunk → 3.3
Does wplink work without the wordpress plugin?
This ticket was mentioned in Slack in #core by lumberhack. View the logs.
11 years ago
#7
follow-up:
↓ 8
@
11 years ago
- Milestone Awaiting Review → 4.3.1
- Resolution fixed
- Status closed → reopened
Reopen for 4.3.
#9
in reply to: ↑ 8
@
11 years ago
- Keywords has-patch added; reporter-feedback removed
Replying to LumberHack:
Disabling the wordpress plugin when using the other custom plugins for TinyMCE is a rare edge case that was fixed in trunk. It affects 4.3 so moved it to the 4.3.1 milestone for consideration.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
fix exception TypeError: editor.wp undefined