Sfoglia il codice sorgente

"id" of the video can be extracted a simpler way.

Kamil Piechaczek 7 anni fa
parent
commit
746b9a8a74
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      packages/ckeditor5-media-embed/src/mediaembedediting.js

+ 4 - 4
packages/ckeditor5-media-embed/src/mediaembedediting.js

@@ -36,7 +36,7 @@ export default class MediaEmbedEditing extends Plugin {
 					name: 'dailymotion',
 					url: /^dailymotion\.com\/video\/(\w+)/,
 					html: match => {
-						const id = match.slice( -1 );
+						const id = match[ 1 ];
 
 						return (
 							'<div style="position: relative; padding-bottom: 100%; height: 0; ">' +
@@ -57,7 +57,7 @@ export default class MediaEmbedEditing extends Plugin {
 						/^open\.spotify\.com\/(track\/\w+)/
 					],
 					html: match => {
-						const id = match.slice( -1 );
+						const id = match[ 1 ];
 
 						return (
 							'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;">' +
@@ -79,7 +79,7 @@ export default class MediaEmbedEditing extends Plugin {
 						/^youtu\.be\/([a-zA-Z0-9_-]+)/
 					],
 					html: match => {
-						const id = match.slice( -1 );
+						const id = match[ 1 ];
 
 						return (
 							'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">' +
@@ -104,7 +104,7 @@ export default class MediaEmbedEditing extends Plugin {
 						/^player\.vimeo\.com\/video\/(\d+)/
 					],
 					html: match => {
-						const id = match.slice( -1 );
+						const id = match[ 1 ];
 
 						return (
 							'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">' +