@@ -12,6 +12,9 @@ import UI from '../components/main.jsx';
1212import React from 'react' ;
1313import ReactDOM from 'react-dom' ;
1414
15+ const EMBED_VIDEO_WIDTH = 560 ;
16+ const EMBED_VIDEO_HEIGHT = 315 ;
17+
1518/**
1619 * AlloyEditor main class. Creates instance of the editor and provides the user configuration
1720 * to the UI.
@@ -51,13 +54,17 @@ extend(Core, Base, {
5154
5255 editor . config . extraPlugins = this . get ( 'extraPlugins' ) ;
5356
57+ editor . config . embedProviders = this . get ( 'embedProviders' ) ;
58+
5459 editor . config . placeholderClass = this . get ( 'placeholderClass' ) ;
5560
5661 editor . config . pasteFromWordRemoveStyles = false ;
5762 editor . config . pasteFromWordRemoveFontStyles = false ;
5863
5964 editor . config . selectionKeystrokes = this . get ( 'selectionKeystrokes' ) ;
6065
66+ editor . config . spritemap = this . get ( 'spritemap' ) ;
67+
6168 Lang . mix ( editor . config , config ) ;
6269
6370 if ( CKEDITOR . env . ie && ! CKEDITOR . env . edge ) {
@@ -315,6 +322,65 @@ extend(Core, Base, {
315322 writeOnce : true
316323 } ,
317324
325+
326+ /**
327+ * List of embed providers for videos
328+ *
329+ * @memberof Core
330+ * @instance
331+ * @property embedProviders
332+ * @default []
333+ * @type Array}
334+ */
335+ embedProviders : {
336+ validator : Lang . isArray ,
337+ value : [
338+ {
339+ id : 'facebook' ,
340+ tpl : `<iframe allowFullScreen="true" allowTransparency="true"
341+ frameborder="0" height="${ EMBED_VIDEO_HEIGHT } "
342+ src="https://www.facebook.com/plugins/video.php?href={embedId}'
343+ &show_text=0&width=${ EMBED_VIDEO_WIDTH } &height=${ EMBED_VIDEO_HEIGHT } " scrolling="no"
344+ style="border:none;overflow:hidden" width="${ EMBED_VIDEO_WIDTH } }"></iframe>` ,
345+ urlSchemes : [
346+ '(https?:\\/\\/(?:www\\.)?facebook.com\\/\\S*\\/videos\\/\\S*)'
347+ ]
348+ } ,
349+ {
350+ id : 'twitch' ,
351+ tpl : `<iframe allowfullscreen="true" frameborder="0"
352+ height="${ EMBED_VIDEO_HEIGHT } "
353+ src="https://player.twitch.tv/?autoplay=false&video={embedId}"
354+ scrolling="no" width="${ EMBED_VIDEO_WIDTH } "></iframe>` ,
355+ urlSchemes : [
356+ 'https?:\\/\\/(?:www\\.)?twitch.tv\\/videos\\/(\\S*)$'
357+ ]
358+ } ,
359+ {
360+ id : 'vimeo' ,
361+ tpl : `<iframe allowfullscreen frameborder="0" height="${ EMBED_VIDEO_HEIGHT } "
362+ mozallowfullscreen src="https://player.vimeo.com/video/{embedId}"
363+ webkitallowfullscreen width="${ EMBED_VIDEO_WIDTH } "></iframe>` ,
364+ urlSchemes : [
365+ 'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/album\\/.*\\/video\\/(\\S*)' ,
366+ 'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/channels\\/.*\\/(\\S*)' ,
367+ 'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/groups\\/.*\\/videos\\/(\\S*)' ,
368+ 'https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\S*)$'
369+ ]
370+ } ,
371+ {
372+ id : 'youtube' ,
373+ tpl : `<iframe allow="autoplay; encrypted-media" allowfullscreen
374+ height="${ EMBED_VIDEO_HEIGHT } " frameborder="0"
375+ src="https://www.youtube.com/embed/{embedId}?rel=0"
376+ width="${ EMBED_VIDEO_WIDTH } "></iframe>` ,
377+ urlSchemes : [
378+ 'https?:\\/\\/(?:www\\.)?youtube.com\\/watch\\?v=(\\S*)$'
379+ ]
380+ }
381+ ]
382+ } ,
383+
318384 /**
319385 * Specifies whether AlloyEditor set the contenteditable attribute
320386 * to "true" on its srcNode.
@@ -456,6 +522,21 @@ extend(Core, Base, {
456522 } ]
457523 } ,
458524
525+ /**
526+ * The path to the spritemap SVG used for icons
527+ *
528+ * @memberof Core
529+ * @instance
530+ * @property spritemap
531+ * @type String
532+ * @writeOnce
533+ */
534+ spritemap : {
535+ validator : Lang . isString ,
536+ value : 'alloy-editor/assets/icons/icons.svg' ,
537+ writeOnce : true
538+ } ,
539+
459540 /**
460541 * The Node ID or HTMl node, which AlloyEditor should use as an editable area.
461542 *
0 commit comments