[wp-trac] [WordPress Trac] #29686: Annoying oEmbed keep show
WordPress Trac
noreply at wordpress.org
Sat Nov 29 16:40:40 UTC 2014
#29686: Annoying oEmbed keep show
--------------------------+------------------------------
Reporter: rajlaksh | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.0
Severity: critical | Resolution:
Keywords: | Focuses: administration
--------------------------+------------------------------
Comment (by programmin):
It looks like this is expected behavior according to the source in wp-
includes/js/tinymce/plugins/wpview/plugin.js:
No explanation is given in the code as to why it must be in an empty p tag
{{{
// When the editor's content changes, scan the new content for
// matching view patterns, and transform the matches into
// view wrappers.
editor.on( 'BeforeSetContent', function( event ) {
var node;
if ( ! event.content ) {
return;
}
if ( selected ) {
removeView( selected );
}
node = editor.selection.getNode();
// When a url is pasted, only try to embed it when pasted
in an empty paragrapgh.
if ( event.content.match( /^\s*(https?:\/\/[^\s"]+)\s*$/i
) &&
( node.nodeName !== 'P' || node.parentNode !==
editor.getBody() || ! editor.dom.isEmpty( node ) ) ) {
return;
}
event.content = wp.mce.views.toViews( event.content );
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29686#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list