diff --git a/summernote-file.js b/summernote-file.js
new file mode 100644
index 0000000..f9f86d6
--- /dev/null
+++ b/summernote-file.js
@@ -0,0 +1,334 @@
+/* https://github.com/DiemenDesign/summernote-video-attributes */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['jquery'],factory);
+ } else if(typeof module === 'object' && module.exports) {
+ module.exports = factory(require('jquery'));
+ } else {
+ factory(window.jQuery);
+ }
+}(function ($) {
+ $.extend(true,$.summernote.lang, {
+ 'en-US': { /* English */
+ videoAttributes: {
+ dialogTitle: 'Video Attributes',
+ tooltip: 'Video Attributes',
+ pluginTitle: 'Video Attributes',
+ href: 'URL',
+ videoSize: 'Video size',
+ videoOption0: 'Responsive',
+ videoOption1: '1280x720',
+ videoOption2: '853x480',
+ videoOption3: '640x360',
+ videoOption4: '560x315',
+ alignment: 'Alignment',
+ alignmentOption0: 'None',
+ alignmentOption1: 'Left',
+ alignmentOption2: 'Right',
+ alignmentOption3: 'Initial',
+ alignmentOption4: 'Inherit',
+ suggested: 'Show Suggested videos when the video finishes',
+ controls: 'Show player controls',
+ autoplay: 'Autoplay',
+ loop: 'Loop',
+ note: 'Note: Not all options are available with all services...',
+ ok: 'OK'
+ }
+ }
+ });
+
+$.extend($.summernote.options, {
+ videoAttributes: {
+ icon: '',
+ showVideoSize: true,
+ showVideoAlignment: true,
+ showSuggestedVideos: true,
+ showPlayerControls: true,
+ showAutoplay: true,
+ showLoop: true
+ }
+});
+
+$.extend($.summernote.plugins, {
+ 'videoAttributes': function (context) {
+ var self = this,
+ ui = $.summernote.ui,
+ $editor = context.layoutInfo.editor,
+ $editable = context.layoutInfo.editable,
+ options = context.options,
+ lang = options.langInfo;
+ context.memo('button.videoAttributes', function() {
+ var button = ui.button({
+ contents: options.videoAttributes.icon,
+ container: false,
+ tooltip: lang.videoAttributes.tooltip,
+ click: function (e) {
+ context.invoke('saveRange');
+ context.invoke('videoAttributes.show');
+ }
+ });
+ return button.render();
+ });
+
+ this.initialize = function () {
+ var $container = options.dialogsInBody ? $(document.body) : $editor;
+ var body =
+ '
' +
+ '';
+
+
+ if (options.videoAttributes.showVideoSize === true) {
+ body += '';
+ }
+
+ if (options.videoAttributes.showVideoAlignment === true) {
+ body += '';
+ }
+
+ if (options.videoAttributes.showSuggestedVideos === true) {
+ body += '';
+ }
+
+ if (options.videoAttributes.showPlayerControls === true) {
+ body += '';
+ }
+
+ if (options.videoAttributes.showAutoplay === true) {
+ body += '';
+ }
+
+ if (options.videoAttributes.showLoop === true) {
+ body += '';
+ }
+
+ this.$dialog = ui.dialog({
+ title: lang.videoAttributes.dialogTitle,
+ body: body,
+ footer: ''
+ }).render().appendTo($container);
+ };
+ this.destroy = function () {
+ ui.hideDialog(this.$dialog);
+ this.$dialog.remove();
+ };
+ this.bindEnterKey = function ($input,$btn) {
+ $input.on('keypress', function (e) {
+ if(e.keyCode === 13) $btn.trigger('click');
+ });
+ };
+ this.bindLabels = function () {
+ self.$dialog.find('.form-control:first').focus().select();
+ self.$dialog.find('label').on('click', function() {
+ $(this).parent().find('.form-control:first').focus();
+ });
+ };
+ this.show = function () {
+ var $vid = $($editable.data('target'));
+ var vidInfo = {
+ vidDom: $vid,
+ href: $vid.attr('href')
+ };
+ this.showLinkDialog(vidInfo).then(function (vidInfo) {
+ ui.hideDialog(self.$dialog);
+ var $vid = vidInfo.vidDom,
+ $videoHref = self.$dialog.find('.note-video-attributes-href'),
+ $videoSize = self.$dialog.find('.note-video-attributes-size'),
+ $videoAlignment = self.$dialog.find('.note-video-attributes-alignment'),
+ $videoSuggested = self.$dialog.find('.note-video-attributes-suggested-checkbox'),
+ $videoControls = self.$dialog.find('.note-video-attributes-controls-checkbox'),
+ $videoAutoplay = self.$dialog.find('.note-video-attributes-autoplay-checkbox'),
+ $videoLoop = self.$dialog.find('.note-video-attributes-loop-checkbox'),
+ url = $videoHref.val(),
+ $videoHTML = $('');
+ if ($videoSize.val() === 0) {
+ $videoHTML.addClass('embed-responsive embed-responsive-16by9');
+ $videoHTML.css({'float': $videoAlignment.val()});
+ }
+
+ var videoWidth = 'auto', videoHeight = 'auto';
+
+ if ($videoSize.val() === "1") videoWidth = '1280', videoHeight = '720';
+ if ($videoSize.val() === "2") videoWidth = '853', videoHeight = '480';
+ if ($videoSize.val() === "3") videoWidth = '640', videoHeight = '360';
+ if ($videoSize.val() === "4") videoWidth = '560', videoHeight = '315';
+ var ytMatch = url.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);
+ var igMatch = url.match(/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/);
+ var vMatch = url.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/);
+ var vimMatch = url.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/);
+ var dmMatch = url.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
+ var youkuMatch = url.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/);
+ var mp4Match = url.match(/^.+.(mp4|m4v)$/);
+ var oggMatch = url.match(/^.+.(ogg|ogv)$/);
+ var webmMatch = url.match(/^.+.(webm)$/);
+ var $video;
+ var urlVars = '';
+ if (ytMatch && ytMatch[1].length === 11) {
+ if (!$videoSuggested.is(':checked')) urlVars += 'rel=0';
+ if (!$videoControls.is(':checked')) urlVars += '&controls=0';
+ if ($videoAutoplay.is(':checked')) urlVars += '&autoplay=1';
+ if (!$videoLoop.is(':checked')) urlVars += '&loop=0';
+ var youtubeId = ytMatch[1];
+ $video = $('