From 41844b105a689314c93922bf567b03b8f1f08b85 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Thu, 14 Mar 2019 11:32:04 +0100 Subject: [PATCH 1/2] Support for a mobile youtube URL. --- src/mediaembedediting.js | 2 ++ tests/mediaembedediting.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/mediaembedediting.js b/src/mediaembedediting.js index cb355f0..418402e 100644 --- a/src/mediaembedediting.js +++ b/src/mediaembedediting.js @@ -79,7 +79,9 @@ export default class MediaEmbedEditing extends Plugin { name: 'youtube', url: [ /^youtube\.com\/watch\?v=([\w-]+)/, + /^m\.youtube\.com\/watch\?v=([\w-]+)/, /^youtube\.com\/v\/([\w-]+)/, + /^m\.youtube\.com\/v\/([\w-]+)/, /^youtube\.com\/embed\/([\w-]+)/, /^youtu\.be\/([\w-]+)/ ], diff --git a/tests/mediaembedediting.js b/tests/mediaembedediting.js index aeb9dad..0d205f8 100644 --- a/tests/mediaembedediting.js +++ b/tests/mediaembedediting.js @@ -206,10 +206,14 @@ describe( 'MediaEmbedEditing', () => { 'https://www.youtube.com/watch?v=foo', 'www.youtube.com/watch?v=foo', 'youtube.com/watch?v=foo', + 'https://m.youtube.com/watch?v=foo', + 'm.youtube.com/watch?v=foo', 'https://www.youtube.com/v/foo', 'www.youtube.com/v/foo', 'youtube.com/v/foo', + 'https://m.youtube.com/v/foo', + 'm.youtube.com/v/foo', 'https://www.youtube.com/embed/foo', 'www.youtube.com/embed/foo', From f9a5e89b208b3e96f4cae325802b0553169ff8c0 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Mon, 18 Mar 2019 11:23:36 +0100 Subject: [PATCH 2/2] Simplified regexps. --- src/mediaembedediting.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mediaembedediting.js b/src/mediaembedediting.js index 418402e..41d0bbc 100644 --- a/src/mediaembedediting.js +++ b/src/mediaembedediting.js @@ -78,10 +78,8 @@ export default class MediaEmbedEditing extends Plugin { { name: 'youtube', url: [ - /^youtube\.com\/watch\?v=([\w-]+)/, - /^m\.youtube\.com\/watch\?v=([\w-]+)/, - /^youtube\.com\/v\/([\w-]+)/, - /^m\.youtube\.com\/v\/([\w-]+)/, + /^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/, + /^(?:m\.)?youtube\.com\/v\/([\w-]+)/, /^youtube\.com\/embed\/([\w-]+)/, /^youtu\.be\/([\w-]+)/ ],