CKEDITOR.plugins.add("html5video", { requires: "widget", lang: "bg,ca,de,en,eu,es,ru,uk,fr,ko,pt,pt-br,pl,zh-cn", icons: "html5video", hidpi: true, init: function(editor) { editor.widgets.add("html5video", { button: editor.lang.html5video.button, template: '
', /* * Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules): * - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-video class. * - video tags with src, controls, width and height attributes. */ allowedContent: "div[data-responsive](!ckeditor-html5-video){text-align,float,margin-left,margin-right}; video[src,poster,controls,autoplay,width, height,loop]{max-width,height};", requiredContent: "div(ckeditor-html5-video); video[src];", upcast: function(element) { return ( element.name === "div" && element.hasClass("ckeditor-html5-video") ); }, dialog: "html5video", init: function() { var src = ""; var autoplay = ""; var loop = ""; var controls = "controls"; var align = this.element.getStyle("text-align"); var width = "100%"; var height = ""; var poster = ""; // If there's a child (the video element) if (this.element.getChild(0)) { // get it's attributes. src = this.element.getChild(0).getAttribute("src"); width = this.element.getChild(0).getAttribute("width"); height = this.element.getChild(0).getAttribute("height"); autoplay = this.element.getChild(0).getAttribute("autoplay"); allowdownload = !this.element .getChild(0) .getAttribute("controlslist"); loop = this.element.getChild(0).getAttribute("loop"); advisorytitle = this.element.getChild(0).getAttribute("title"); controls = this.element.getChild(0).getAttribute("controls"); responsive = this.element.getAttribute("data-responsive"); poster = this.element.getChild(0).getAttribute("poster"); } if (src) { this.setData("src", src); if (align) { this.setData("align", align); } else { this.setData("align", "none"); } if (width) { this.setData("width", width); } if (height) { this.setData("height", height); } if (autoplay) { this.setData("autoplay", "yes"); } if (allowdownload) { this.setData("allowdownload", "yes"); } if (loop) { this.setData("loop", "yes"); } if (advisorytitle) { this.setData("advisorytitle", advisorytitle); } if (responsive) { this.setData("responsive", responsive); } if (controls) { this.setData("controls", controls); } if (poster) { this.setData("poster", poster); } } else { if (controls) { this.setData("controls", controls); } if (width) { this.setData("width", width); } if (height) { this.setData("height", height); } } }, data: function() { // If there is an video source if (this.data.src) { // and there isn't a child (the video element) if (!this.element.getChild(0)) { // Create a new