diff --git a/modules/editor/skins/simpleeditor/js/simpleeditor.js b/modules/editor/skins/simpleeditor/js/simpleeditor.js index 6be3f95c7..84302c0b4 100644 --- a/modules/editor/skins/simpleeditor/js/simpleeditor.js +++ b/modules/editor/skins/simpleeditor/js/simpleeditor.js @@ -54,9 +54,14 @@ // Convert YouTube links. var convertYouTube = function(str) { - var regexp = /(?
'; - return String(str).replace(regexp, embed); + var regexp = /(src=")?https?:\/\/(www\.youtube(?:-nocookie)?\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]+)\S*/g; + return String(str).replace(regexp, function(match, p1, p2, p3) { + if (p1 === 'src="') { + return match; + } else { + return ''; + } + }); }; // Page load event handler.