WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#23876 closed defect (bug) (fixed)

Embedding mp3 breaks TinyMCE

Reported by: ericlewis Owned by: nacin
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.4
Component: TinyMCE Keywords: has-patch commit
Focuses: Cc:

Description

Add a simple mp3 embed tag to a page in the Text (HTML) mode. Switch to the Visual mode, and you won't be able to get back to the Text mode.

<embed src="example.mp3" width="640" height="480">

The resulting JS error blames the TinyMCE:

Uncaught TypeError: Cannot read property '0' of undefined in editor_plugin_src.js:480

Attachments (3)

23876.diff (927 bytes) - added by wonderboymusic 13 months ago.
23876.2.diff (1.3 KB) - added by SergeyBiryukov 13 months ago.
23876-3.patch (698 bytes) - added by azaozz 13 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 nacin13 months ago

  • Milestone changed from Awaiting Review to 3.6

This seems like a major problem especially given new stuff in 3.6.

wonderboymusic13 months ago

comment:2 wonderboymusic13 months ago

  • Keywords has-patch commit added

SergeyBiryukov13 months ago

comment:3 SergeyBiryukov13 months ago

23876.diff works, but I get this when switching to Text mode:

<object width="640" height="480" classid="clsid:undefined"><param name="src" value="example.mp3" /><embed width="640" height="480" src="example.mp3" /></object>

23876.2.diff removes classid="clsid:undefined".

comment:4 nacin13 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 23895:

Prevent a JS error when working with embedded media in TinyMCE.

props wonderboymusic. fixes #23876.

comment:5 nacin13 months ago

In 23896:

Prevent classid="clsid:undefined". props SergeyBiryukov. see #23876.

azaozz13 months ago

comment:6 azaozz13 months ago

  • Cc spocke added

Looked at that too, it's more complex than just fixing the error. The MCE media plugin shouldn't wrap a simple <embed> tag in an <object>.

Looks like it gets the internal 'type' wrong (as it looks at the mp3 extension) and assumes it's an <audio> tag rather than <embed>. 23876-3.patch fixes that (and doesn't require the other fixes) but needs more testing.

Note: See TracTickets for help on using tickets.