Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29686 closed defect (bug) (fixed)

Annoying oEmbed keep show

Reported by: rajlaksh's profile rajlaksh Owned by:
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.0
Component: Embeds Keywords: has-patch
Focuses: Cc:

Description

How to Disable oEmebed for url? when i paste google.com url in new post oEmebed shows.

When i pasted google.com it shows

http://s1.directupload.net/images/140916/ss86kkx2.png

Attachments (1)

29686.patch (968 bytes) - added by iseulde 10 years ago.

Download all attachments as: .zip

Change History (19)

#1 @rajlaksh
10 years ago

  • Severity changed from normal to critical

I'm using this filter

remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );

still it showing.

#2 @SergeyBiryukov
10 years ago

Confirmed, and it's not limited to http://google.com.

If I paste any URL into TinyMCE, it's displayed as an oEmbed view for a couple of seconds.

#3 @SergeyBiryukov
10 years ago

  • Summary changed from Annoying oEmbed keep show . to Annoying oEmbed keep show

#4 @iseulde
10 years ago

Yes, I think there's a ticket for this somewhere. To fix this, we need to change how views are loaded in the editor.
However, I don't think we disable the oEmbed views if the filter is removed.

#5 @rajlaksh
10 years ago

Thank You Core Team for reply . How to fix it?

Last edited 10 years ago by rajlaksh (previous) (diff)

#6 @SergeyBiryukov
10 years ago

Replying to avryl:

Yes, I think there's a ticket for this somewhere.

Related: #29268

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in IRC in #wordpress-dev by johnbillion. View the logs.


10 years ago

#8 @programmin
10 years ago

Looks like the solution to this particular problem is pasting into an existing line - or pasting into anywhere that is not a new p tag.

I'm seeing the exact opposite problem in that when you paste a youtube url into the editor in 4.1, it seems it will only ever turn into an embed if it happens to be pasted on a blank paragraph.

If you're using forced_root_block=div mce option, or even just have started with

<div>text</div>

on a post, it seems you can never insert embed by pasting a url, or pasting url on a new line.

#9 @programmin
10 years ago

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 );
	});

#10 @rajlaksh
10 years ago

When it will Fixed?

#11 @rajlaksh
10 years ago

Won 4.1 version is out without fixing it.

I'm waiting for Offical release with fixed it. But Newer Version keep coming. If it will not gonna fixed i have to Remove oEmbed from WP Mannual so it will not annoy me.

#12 @rajlaksh
10 years ago

  • Focuses javascript added

#13 @rajlaksh
10 years ago

@SergeyBiryukov when WP team gonna fix it?

This ticket was mentioned in IRC in #wordpress-dev by rajlaksh. View the logs.


10 years ago

#15 @SergeyBiryukov
10 years ago

  • Severity changed from critical to normal

As noted in comment:2, unexpected oEmbed view only shows up for a couple of seconds. It might be annoying, but it doesn't seem critical.

See also #29841, which has a patch and appears to resolve this.

#16 @iseulde
10 years ago

See also #31412. It will probably be fixed there.

@iseulde
10 years ago

#17 @iseulde
10 years ago

  • Component changed from Editor to Embeds
  • Focuses javascript administration removed
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

Not sure if this is a good fix, but it works.
Something to look out for here is widgets...

#18 @azaozz
10 years ago

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

The problem reported here was fixed in #31412. When pasting a non-embeddable URL in an empty paragraph in the editor, we wait for the embed check to return before converting it to a wpView.

As to completely disabling this feature (embed when pasting embeddable URL), we can make that easier by adding a filter, perhaps in wp_ajax_parse_embed(). This enhancement will need a new ticket :)

Fixed in [31546].

Note: See TracTickets for help on using tickets.