Opened 2 years ago
Last modified 8 months ago
#17764 assigned defect (bug)
TinyMCE breaks the autoembed feature
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Media | Version: | 2.0 |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | stas@… |
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 (19)
- Milestone changed from Awaiting Review to 3.2
- Owner set to azaozz
- Severity changed from normal to critical
- Status changed from new to assigned
Ok, It's just that in opera, it doesn't auto link :) confirmed in IE.
Chrome doesn't do it too. Only IE.
See http://tinymce.moxiecode.com/forum/viewtopic.php?id=14901
- Severity changed from critical to normal
- Version set to 3.1
Also happens in 3.1.
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.
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
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.
comment:10
dd32 — 2 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.
comment:11
hebbet — 2 years ago
tested with chromium 14: pasted url from ominbox is not autolinked in tinymce
comment:12
follow-up:
↓ 14
ocean90 — 2 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');
comment:13
azaozz — 2 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.
comment:14
in reply to:
↑ 12
;
follow-up:
↓ 15
azaozz — 2 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.
comment:15
in reply to:
↑ 14
ocean90 — 2 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.
comment:16
sushkov — 15 months 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.
comment:17
ocean90 — 8 months ago
#21915 was marked as a duplicate.

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.