Opened 13 years ago
Closed 10 years ago
#17764 closed defect (bug) (worksforme)
TinyMCE breaks the autoembed feature
Reported by: | dzver | Owned by: | azaozz |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
The auto embedding works with URLs on a separate line:
http://www.youtube.com/watch?v=e0Qt5CKdoOY
Right now the Visual Editor makes all URLs clickable:
<a href="http://www.youtube.com/watch?v=e0Qt5CKdoOY">http://www.youtube.com/watch?v=e0Qt5CKdoOY</a>
and auto embedding no longer works.
Reported here:
http://en.forums.wordpress.com/topic/embedding-video-does-not-work?replies=1
Attachments (2)
Change History (21)
#1
@
13 years ago
- Milestone changed from Awaiting Review to 3.2
- Owner set to azaozz
- Severity changed from normal to critical
- Status changed from new to assigned
#4
@
13 years ago
Chrome doesn't do it too. Only IE.
See http://tinymce.moxiecode.com/forum/viewtopic.php?id=14901
#7
@
13 years ago
Chrome 12 on windows and ubuntu does autolinking in tinymce.
Hmm, Chrome 12.0.742.91 on windows doesn't do it for me.
From what I can find, it is only related to IE and ContentEditable.
#8
@
13 years ago
Info to Chrome: If you copy the link from the omnibox and paste it to the editor it will be linked.
Maybe this can fix the problem:
http://stackoverflow.com/questions/687552/prevent-tinymce-internet-explorer-from-converting-urls-to-links/5459254#5459254
#9
@
13 years ago
I reproduced the problem with Chrome 13 and Firefox 4.0.1. Try to copy/paste a Youtube link from youtube.com.
Copy/paste in TinyMCE doesn't work at all with my Opera 11.11/Win7.
#10
@
13 years ago
yeah, as ocean90 pointed out, If you copy a url from within chrome and paste it, it treats it as a link, If you paste from say, opera, it treats it as text.
#12
follow-up:
↓ 14
@
13 years ago
I couldn't reproduce it in Firefox. But here is a workaround for Chrome:
function my_remove_a_tag( $init ) { $init['paste_preprocess'] = "function(pl, o) {o.content = o.content.replace( /<a[^>]*>(.*?)<\/a>/gi, '$1' );}"; return $init; } add_filter( 'tiny_mce_before_init', 'my_remove_a_tag');
#13
@
13 years ago
- Keywords needs-patch added; has-patch removed
- Milestone changed from 3.2 to Future Release
- Version changed from 3.1 to 2.0
This is not a regression, it's been around since we started using TinyMCE (WordPress 2.0) and yes, it is a feature in IE. In other browsers it depends on what you copy: if you copy "link location" it pastes it as text but if you copy linked text (that can be the actual URL) it pastes it as a link.
Both of the above patches would fix this in IE but at the same time would convert to text some links too. They also need to test whether the href == linked text. Perhaps doing this in PHP is better as we know what URLs to look for and only convert for them.
There is an easy workaround: after the URL is converted, click on it and click on "Remove Link" button. Since this is not critical bug or regression, moving to 3.3.
#14
in reply to:
↑ 12
;
follow-up:
↓ 15
@
13 years ago
Replying to ocean90:
I couldn't reproduce it in Firefox. But here is a workaround for Chrome:
This will remove all links from pasted content that is undesirable. Quite a few people seem to paste in TinyMCE, we shouldn't break that.
#15
in reply to:
↑ 14
@
13 years ago
Replying to azaozz:
Replying to ocean90:
I couldn't reproduce it in Firefox. But here is a workaround for Chrome:
This will remove all links from pasted content that is undesirable. Quite a few people seem to paste in TinyMCE, we shouldn't break that.
In my tests it only replaces the a tags from the Chrome link. But my code should only be a hint, nothing serious.
#16
@
13 years ago
- Cc stas@… added
- Keywords has-patch dev-feedback added; needs-patch removed
Updated the patch. Regexp was ok, but it didn't work because of $match
parameter.
#19
@
10 years ago
- Keywords dev-feedback removed
- Milestone Future Release deleted
- Resolution set to worksforme
- Status changed from assigned to closed
If you paste a YouTube URL now, like https://www.youtube.com/watch?v=ZqD-LPOWIT0
, it will show a YouTube video. Sweet since [28358]. The example in this ticket is a dead video.
Sounds like a regression.
Posts don't have make_clickable, so the right fix here should be to disable said TinyMCE feature.
That said, entirely unrelated, it's always bugged me that a failed oEmbed doesn't make the URL a link.