bedrock_sass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
- data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
- data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
- data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
- data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
- data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
- data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
- data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
- data/assets/_vendor/tinymce/tinymce.js +44399 -0
- data/assets/bedrock/js/bedrock.js +16587 -6193
- data/assets/bedrock/scss/_bedrock-components.scss +16 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
- data/assets/bedrock/scss/components/global.scss +16 -8
- data/assets/bedrock/scss/components/helper-classes.scss +59 -0
- data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
- data/assets/bedrock/scss/components/login-box.scss +48 -0
- data/assets/bedrock/scss/components/no-content.scss +31 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
- data/assets/bedrock/scss/components/page-content.scss +51 -0
- data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
- data/assets/bedrock/scss/components/select-box.scss +332 -0
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
- data/lib/bedrock_sass.rb +6 -0
- data/lib/bedrock_sass/engine.rb +8 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +11 -0
- metadata +188 -2
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("6",tinymce.util.Tools.resolve),g("1",["6"],function(a){return a("tinymce.PluginManager")}),g("g",["6"],function(a){return a("tinymce.dom.RangeUtils")}),g("h",["6"],function(a){return a("tinymce.dom.TreeWalker")}),g("b",["6"],function(a){return a("tinymce.util.VK")}),g("i",["6"],function(a){return a("tinymce.dom.BookmarkManager")}),g("d",["6"],function(a){return a("tinymce.util.Tools")}),g("j",["6"],function(a){return a("tinymce.dom.DOMUtils")}),g("e",[],function(){var a=function(a){return a&&3===a.nodeType},b=function(a){return a&&/^(OL|UL|DL)$/.test(a.nodeName)},c=function(a){return a&&/^(LI|DT|DD)$/.test(a.nodeName)},d=function(a){return a&&/^(TH|TD)$/.test(a.nodeName)},e=function(a){return a&&"BR"===a.nodeName},f=function(a){return a.parentNode.firstChild===a},g=function(a){return a.parentNode.lastChild===a},h=function(a,b){return b&&!!a.schema.getTextBlockElements()[b.nodeName]},i=function(a,b){return a&&a.nodeName in b},j=function(a,b){return!!e(b)&&!(!a.isBlock(b.nextSibling)||e(b.previousSibling))},k=function(a,b,c){var d=a.isEmpty(b);return!(c&&a.select("span[data-mce-type=bookmark]",b).length>0)&&d},l=function(a,b){return a.isChildOf(b,a.getRoot())};return{isTextNode:a,isListNode:b,isListItemNode:c,isTableCellNode:d,isBr:e,isFirstChild:f,isLastChild:g,isTextBlock:h,isBlock:i,isBogusBr:j,isEmpty:k,isChildOfBody:l}}),g("p",["g","e"],function(a,b){var c=function(c,d){var e=a.getNode(c,d);if(b.isListItemNode(c)&&b.isTextNode(e)){var f=d>=c.childNodes.length?e.data.length:0;return{container:e,offset:f}}return{container:c,offset:d}},d=function(a){var b=a.cloneRange(),d=c(a.startContainer,a.startOffset);b.setStart(d.container,d.offset);var e=c(a.endContainer,a.endOffset);return b.setEnd(e.container,e.offset),b};return{getNormalizedEndPoint:c,normalizeRange:d}}),g("k",["j","e","p"],function(a,b,c){var d=a.DOM,e=function(a){var b={},c=function(c){var e,f,g;f=a[c?"startContainer":"endContainer"],g=a[c?"startOffset":"endOffset"],1===f.nodeType&&(e=d.create("span",{"data-mce-type":"bookmark"}),f.hasChildNodes()?(g=Math.min(g,f.childNodes.length-1),c?f.insertBefore(e,f.childNodes[g]):d.insertAfter(e,f.childNodes[g])):f.appendChild(e),f=e,g=0),b[c?"startContainer":"endContainer"]=f,b[c?"startOffset":"endOffset"]=g};return c(!0),a.collapsed||c(),b},f=function(a){function b(b){var c,e,f,g=function(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b===a)return c;1===b.nodeType&&"bookmark"===b.getAttribute("data-mce-type")||c++,b=b.nextSibling}return-1};c=f=a[b?"startContainer":"endContainer"],e=a[b?"startOffset":"endOffset"],c&&(1===c.nodeType&&(e=g(c),c=c.parentNode,d.remove(f),!c.hasChildNodes()&&d.isBlock(c)&&c.appendChild(d.create("br"))),a[b?"startContainer":"endContainer"]=c,a[b?"startOffset":"endOffset"]=e)}b(!0),b();var e=d.createRng();return e.setStart(a.startContainer,a.startOffset),a.endContainer&&e.setEnd(a.endContainer,a.endOffset),c.normalizeRange(e)};return{createBookmark:e,resolveBookmark:f}}),g("l",["j","d","e"],function(a,b,c){var d=a.DOM,e=function(a,b){var e,f=b.parentNode;"LI"===f.nodeName&&f.firstChild===b&&(e=f.previousSibling,e&&"LI"===e.nodeName?(e.appendChild(b),c.isEmpty(a,f)&&d.remove(f)):d.setStyle(f,"listStyleType","none")),c.isListNode(f)&&(e=f.previousSibling,e&&"LI"===e.nodeName&&e.appendChild(b))},f=function(a,c){b.each(b.grep(a.select("ol,ul",c)),function(b){e(a,b)})};return{normalizeList:e,normalizeLists:f}}),g("m",["6"],function(a){return a("tinymce.dom.DomQuery")}),g("f",["m","d","e"],function(a,b,c){var d=function(a){var b=a.selection.getStart(!0);return a.dom.getParent(b,"OL,UL,DL",j(a,b))},e=function(a,b){return a&&1===b.length&&b[0]===a},f=function(a){return b.grep(a.querySelectorAll("ol,ul,dl"),function(a){return c.isListNode(a)})},g=function(a){var g=d(a),h=a.selection.getSelectedBlocks();return e(g,h)?f(g):b.grep(h,function(a){return c.isListNode(a)&&g!==a})},h=function(c,d){var e=b.map(d,function(a){var b=c.dom.getParent(a,"li,dd,dt",j(c,a));return b?b:a});return a.unique(e)},i=function(a){var d=a.selection.getSelectedBlocks();return b.grep(h(a,d),function(a){return c.isListItemNode(a)})},j=function(a,b){var c=a.dom.getParents(b,"TD,TH"),d=c.length>0?c[0]:a.getBody();return d};return{getParentList:d,getSelectedSubLists:g,getSelectedListItems:i,getClosestListRootElm:j}}),g("q",["6"],function(a){return a("tinymce.Env")}),g("o",["j","q","e"],function(a,b,c){var d=a.DOM,e=function(a,e,f){var g,h,i,j=d.createFragment(),k=a.schema.getBlockElements();if(a.settings.forced_root_block&&(f=f||a.settings.forced_root_block),f&&(h=d.create(f),h.tagName===a.settings.forced_root_block&&d.setAttribs(h,a.settings.forced_root_block_attrs),c.isBlock(e.firstChild,k)||j.appendChild(h)),e)for(;g=e.firstChild;){var l=g.nodeName;i||"SPAN"===l&&"bookmark"===g.getAttribute("data-mce-type")||(i=!0),c.isBlock(g,k)?(j.appendChild(g),h=null):f?(h||(h=d.create(f),j.appendChild(h)),h.appendChild(g)):j.appendChild(g)}return a.settings.forced_root_block?i||b.ie&&!(b.ie>10)||h.appendChild(d.create("br",{"data-mce-bogus":"1"})):j.appendChild(d.create("br")),j};return{createNewTextBlock:e}}),g("n",["j","e","o","d"],function(a,b,c,d){var e=a.DOM,f=function(a,f,g,h){var i,j,k,l,m=function(a){d.each(k,function(b){a.parentNode.insertBefore(b,g.parentNode)}),e.remove(a)};for(k=e.select('span[data-mce-type="bookmark"]',f),h=h||c.createNewTextBlock(a,g),i=e.createRng(),i.setStartAfter(g),i.setEndAfter(f),j=i.extractContents(),l=j.firstChild;l;l=l.firstChild)if("LI"===l.nodeName&&a.dom.isEmpty(l)){e.remove(l);break}a.dom.isEmpty(j)||e.insertAfter(j,f),e.insertAfter(h,f),b.isEmpty(a.dom,g.parentNode)&&m(g.parentNode),e.remove(g),b.isEmpty(a.dom,f)&&e.remove(f)};return{splitList:f}}),g("9",["j","k","e","l","f","n","o"],function(a,b,c,d,e,f,g){var h=a.DOM,i=function(a,b){c.isEmpty(a,b)&&h.remove(b)},j=function(a,b){var e,j=b.parentNode,k=j.parentNode;return j===a.getBody()||("DD"===b.nodeName?(h.rename(b,"DT"),!0):c.isFirstChild(b)&&c.isLastChild(b)?("LI"===k.nodeName?(h.insertAfter(b,k),i(a.dom,k),h.remove(j)):c.isListNode(k)?h.remove(j,!0):(k.insertBefore(g.createNewTextBlock(a,b),j),h.remove(j)),!0):c.isFirstChild(b)?("LI"===k.nodeName?(h.insertAfter(b,k),b.appendChild(j),i(a.dom,k)):c.isListNode(k)?k.insertBefore(b,j):(k.insertBefore(g.createNewTextBlock(a,b),j),h.remove(b)),!0):c.isLastChild(b)?("LI"===k.nodeName?h.insertAfter(b,k):c.isListNode(k)?h.insertAfter(b,j):(h.insertAfter(g.createNewTextBlock(a,b),j),h.remove(b)),!0):("LI"===k.nodeName?(j=k,e=g.createNewTextBlock(a,b,"LI")):e=c.isListNode(k)?g.createNewTextBlock(a,b,"LI"):g.createNewTextBlock(a,b),f.splitList(a,j,b,e),d.normalizeLists(a.dom,j.parentNode),!0))},k=function(a){var c=e.getSelectedListItems(a);if(c.length){var d,f,g=b.createBookmark(a.selection.getRng(!0)),h=e.getClosestListRootElm(a,a.selection.getStart(!0));for(d=c.length;d--;)for(var i=c[d].parentNode;i&&i!==h;){for(f=c.length;f--;)if(c[f]===i){c.splice(d,1);break}i=i.parentNode}for(d=0;d<c.length&&(j(a,c[d])||0!==d);d++);return a.selection.setRng(b.resolveBookmark(g)),a.nodeChanged(),!0}};return{outdent:j,outdentSelection:k}}),g("a",["i","d","9","k","e","l","f","n"],function(a,b,c,d,e,f,g,h){var i=function(a,b,c){var d=c["list-style-type"]?c["list-style-type"]:null;a.setStyle(b,"list-style-type",d)},j=function(a,c){b.each(c,function(b,c){a.setAttribute(c,b)})},k=function(a,c,d){j(c,d["list-attributes"]),b.each(a.select("li",c),function(a){j(a,d["list-item-attributes"])})},l=function(a,b,c){i(a,b,c),k(a,b,c)},m=function(a,b,c,d){var f,g;for(f=b[c?"startContainer":"endContainer"],g=b[c?"startOffset":"endOffset"],1===f.nodeType&&(f=f.childNodes[Math.min(g,f.childNodes.length-1)]||f),!c&&e.isBr(f.nextSibling)&&(f=f.nextSibling);f.parentNode!==d;){if(e.isTextBlock(a,f))return f;if(/^(TD|TH)$/.test(f.parentNode.nodeName))return f;f=f.parentNode}return f},n=function(c,d,f){for(var g,h=[],i=c.dom,j=m(c,d,!0,f),k=m(c,d,!1,f),l=[],n=j;n&&(l.push(n),n!==k);n=n.nextSibling);return b.each(l,function(b){if(e.isTextBlock(c,b))return h.push(b),void(g=null);if(i.isBlock(b)||e.isBr(b))return e.isBr(b)&&i.remove(b),void(g=null);var d=b.nextSibling;return a.isBookmarkNode(b)&&(e.isTextBlock(c,d)||!d&&b.parentNode===f)?void(g=null):(g||(g=i.create("p"),b.parentNode.insertBefore(g,b),h.push(g)),void g.appendChild(b))}),h},o=function(a,b,c){var d=a.getStyle(b,"list-style-type"),e=c?c["list-style-type"]:"";return e=null===e?"":e,d===e},p=function(a,c,f){var h,i=a.selection.getRng(!0),j="LI",k=g.getClosestListRootElm(a,a.selection.getStart(!0)),m=a.dom;f=f?f:{},"false"!==m.getContentEditable(a.selection.getNode())&&(c=c.toUpperCase(),"DL"===c&&(j="DT"),h=d.createBookmark(i),b.each(n(a,i,k),function(b){var d,g;g=b.previousSibling,g&&e.isListNode(g)&&g.nodeName===c&&o(m,g,f)?(d=g,b=m.rename(b,j),g.appendChild(b)):(d=m.create(c),b.parentNode.insertBefore(d,b),d.appendChild(b),b=m.rename(b,j)),l(m,d,f),v(a.dom,d)}),a.selection.setRng(d.resolveBookmark(h)))},q=function(a){var i=d.createBookmark(a.selection.getRng(!0)),j=g.getClosestListRootElm(a,a.selection.getStart(!0)),k=g.getSelectedListItems(a),l=b.grep(k,function(b){return a.dom.isEmpty(b)});k=b.grep(k,function(b){return!a.dom.isEmpty(b)}),b.each(l,function(b){if(e.isEmpty(a.dom,b))return void c.outdent(a,b)}),b.each(k,function(b){var c,d;if(b.parentNode!==a.getBody()){for(c=b;c&&c!==j;c=c.parentNode)e.isListNode(c)&&(d=c);h.splitList(a,d,b),f.normalizeLists(a.dom,d.parentNode)}}),a.selection.setRng(d.resolveBookmark(i))},r=function(a,b){return a&&b&&e.isListNode(a)&&a.nodeName===b.nodeName},s=function(a,b,c){var d=a.getStyle(b,"list-style-type",!0),e=a.getStyle(c,"list-style-type",!0);return d===e},t=function(a,b){return a.className===b.className},u=function(a,b,c){return r(b,c)&&s(a,b,c)&&t(b,c)},v=function(a,b){var c,d;if(c=b.nextSibling,u(a,b,c)){for(;d=c.firstChild;)b.appendChild(d);a.remove(c)}if(c=b.previousSibling,u(a,b,c)){for(;d=c.lastChild;)b.insertBefore(d,b.firstChild);a.remove(c)}},w=function(a,b,c,d){if(b.nodeName!==c){var e=a.rename(b,c);l(a,e,d)}else l(a,b,d)},x=function(a,c,e,f,g){if(c.nodeName!==f||y(g)){var h=d.createBookmark(a.selection.getRng(!0));b.each([c].concat(e),function(b){w(a.dom,b,f,g)}),a.selection.setRng(d.resolveBookmark(h))}else q(a,f)},y=function(a){return"list-style-type"in a},z=function(a,b,c,e){if(b!==a.getBody())if(b)if(b.nodeName!==c||y(e)){var f=d.createBookmark(a.selection.getRng(!0));l(a.dom,b,e),v(a.dom,a.dom.rename(b,c)),a.selection.setRng(d.resolveBookmark(f))}else q(a,c);else p(a,c,e)},A=function(a,b,c){var d=g.getParentList(a),e=g.getSelectedSubLists(a);c=c?c:{},d&&e.length>0?x(a,d,e,b,c):z(a,d,b,c)};return{toggleList:A,removeList:q,mergeWithAdjacentLists:v}}),g("7",["g","h","b","a","k","e","l","p","f"],function(a,b,c,d,e,f,g,h,i){var j=function(c,d,e,g){var h,i,j=d.startContainer,k=d.startOffset;if(3===j.nodeType&&(e?k<j.data.length:k>0))return j;for(h=c.schema.getNonEmptyElements(),1===j.nodeType&&(j=a.getNode(j,k)),i=new b(j,g),e&&f.isBogusBr(c.dom,j)&&i.next();j=i[e?"next":"prev2"]();){if("LI"===j.nodeName&&!j.hasChildNodes())return j;if(h[j.nodeName])return j;if(3===j.nodeType&&j.data.length>0)return j}},k=function(a,b){var c=b.childNodes;return 1===c.length&&!f.isListNode(c[0])&&a.isBlock(c[0])},l=function(a,b){k(a,b)&&a.remove(b.firstChild,!0)},m=function(a,b,c){var d,e;if(e=k(a,c)?c.firstChild:c,l(a,b),!f.isEmpty(a,b,!0))for(;d=b.firstChild;)e.appendChild(d)},n=function(a,b,c){var d,e,g=b.parentNode;f.isChildOfBody(a,b)&&f.isChildOfBody(a,c)&&(f.isListNode(c.lastChild)&&(e=c.lastChild),g===c.lastChild&&f.isBr(g.previousSibling)&&a.remove(g.previousSibling),d=c.lastChild,d&&f.isBr(d)&&b.hasChildNodes()&&a.remove(d),f.isEmpty(a,c,!0)&&a.$(c).empty(),m(a,b,c),e&&c.appendChild(e),a.remove(b),f.isEmpty(a,g)&&g!==a.getRoot()&&a.remove(g))},o=function(a,b,c){a.dom.$(c).empty(),n(a.dom,b,c),a.selection.setCursorLocation(c)},p=function(a,b,c,d){var f=a.dom;if(f.isEmpty(d))o(a,c,d);else{var g=e.createBookmark(b);n(f,c,d),a.selection.setRng(e.resolveBookmark(g))}},q=function(a,b,c,d){var f=e.createBookmark(b);n(a.dom,c,d);var g=e.resolveBookmark(f);a.selection.setRng(g)},r=function(a,b){var c,e,g,k=a.dom,l=a.selection,m=l.getStart(),n=i.getClosestListRootElm(a,m),o=k.getParent(l.getStart(),"LI",n);if(o){if(c=o.parentNode,c===a.getBody()&&f.isEmpty(k,c))return!0;if(e=h.normalizeRange(l.getRng(!0)),g=k.getParent(j(a,e,b,n),"LI",n),g&&g!==o)return b?p(a,e,g,o):q(a,e,o,g),!0;if(!g&&!b&&d.removeList(a,c.nodeName))return!0}return!1},s=function(a,b,c){var d=a.getParent(b.parentNode,a.isBlock,c);a.remove(b),d&&a.isEmpty(d)&&a.remove(d)},t=function(a,b){var c=a.dom,e=a.selection.getStart(),f=i.getClosestListRootElm(a,e),g=c.getParent(e,c.isBlock,f);if(g&&c.isEmpty(g)){var k=h.normalizeRange(a.selection.getRng(!0)),l=c.getParent(j(a,k,b,f),"LI",f);if(l)return a.undoManager.transact(function(){s(c,g,f),d.mergeWithAdjacentLists(c,l.parentNode),a.selection.select(l,!0),a.selection.collapse(b)}),!0}return!1},u=function(a,b){return r(a,b)||t(a,b)},v=function(a){var b=a.selection.getStart(),c=i.getClosestListRootElm(a,b),d=a.dom.getParent(b,"LI,DT,DD",c);return!!(d||i.getSelectedListItems(a).length>0)&&(a.undoManager.transact(function(){a.execCommand("Delete"),g.normalizeLists(a.dom,a.getBody())}),!0)},w=function(a,b){return a.selection.isCollapsed()?u(a,b):v(a)},x=function(a){a.on("keydown",function(b){b.keyCode===c.BACKSPACE?w(a,!1)&&b.preventDefault():b.keyCode===c.DELETE&&w(a,!0)&&b.preventDefault()})};return{setup:x,backspaceDelete:w}}),g("2",["7"],function(a){var b=function(b){return{backspaceDelete:function(c){a.backspaceDelete(b,c)}}};return{get:b}}),g("8",["j","k","e","f"],function(a,b,c,d){var e=a.DOM,f=function(a,b){var d;if(c.isListNode(a)){for(;d=a.firstChild;)b.appendChild(d);e.remove(a)}},g=function(a){var b,d,g;return"DT"===a.nodeName?(e.rename(a,"DD"),!0):(b=a.previousSibling,b&&c.isListNode(b)?(b.appendChild(a),!0):b&&"LI"===b.nodeName&&c.isListNode(b.lastChild)?(b.lastChild.appendChild(a),f(a.lastChild,b.lastChild),!0):(b=a.nextSibling,b&&c.isListNode(b)?(b.insertBefore(a,b.firstChild),!0):(b=a.previousSibling,!(!b||"LI"!==b.nodeName)&&(d=e.create(a.parentNode.nodeName),g=e.getStyle(a.parentNode,"listStyleType"),g&&e.setStyle(d,"listStyleType",g),b.appendChild(d),d.appendChild(a),f(a.lastChild,d),!0))))},h=function(a){var c=d.getSelectedListItems(a);if(c.length){for(var e=b.createBookmark(a.selection.getRng(!0)),f=0;f<c.length&&(g(c[f])||0!==f);f++);return a.selection.setRng(b.resolveBookmark(e)),a.nodeChanged(),!0}};return{indentSelection:h}}),g("3",["8","9","a"],function(a,b,c){var d=function(a,b){return function(){var c=a.dom.getParent(a.selection.getStart(),"UL,OL,DL");return c&&c.nodeName===b}},e=function(e){e.on("BeforeExecCommand",function(c){var d,f=c.command.toLowerCase();if("indent"===f?a.indentSelection(e)&&(d=!0):"outdent"===f&&b.outdentSelection(e)&&(d=!0),d)return e.fire("ExecCommand",{command:c.command}),c.preventDefault(),!0}),e.addCommand("InsertUnorderedList",function(a,b){c.toggleList(e,"UL",b)}),e.addCommand("InsertOrderedList",function(a,b){c.toggleList(e,"OL",b)}),e.addCommand("InsertDefinitionList",function(a,b){c.toggleList(e,"DL",b)}),e.addQueryStateHandler("InsertUnorderedList",d(e,"UL")),e.addQueryStateHandler("InsertOrderedList",d(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",d(e,"DL"))};return{register:e}}),g("c",[],function(){var a=function(a){return a.getParam("lists_indent_on_tab",!0)};return{shouldIndentOnTab:a}}),g("4",["b","8","9","c","7"],function(a,b,c,d,e){var f=function(d){d.on("keydown",function(e){e.keyCode!==a.TAB||a.metaKeyPressed(e)||d.dom.getParent(d.selection.getStart(),"LI,DT,DD")&&(e.preventDefault(),e.shiftKey?c.outdentSelection(d):b.indentSelection(d))})},g=function(a){d.shouldIndentOnTab(a)&&f(a),e.setup(a)};return{setup:g}}),g("5",["d","e","f"],function(a,b,c){var d=function(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(b(d))return c}return-1},e=function(c,e){return function(f){var g=f.control;c.on("NodeChange",function(c){var f=d(c.parents,b.isTableCellNode),h=f!==-1?c.parents.slice(0,f):c.parents,i=a.grep(h,b.isListNode);g.active(i.length>0&&i[0].nodeName===e)})}},f=function(a){return function(d){var e=d.control;a.on("nodechange",function(){var d=c.getSelectedListItems(a),f=d.length>0&&b.isFirstChild(d[0]);e.disabled(f)})}},g=function(b){var c=function(b,c){var d=b.settings.plugins?b.settings.plugins:"";return a.inArray(d.split(/[ ,]/),c)!==-1};c(b,"advlist")||(b.addButton("numlist",{active:!1,title:"Numbered list",cmd:"InsertOrderedList",onPostRender:e(b,"OL")}),b.addButton("bullist",{active:!1,title:"Bullet list",cmd:"InsertUnorderedList",onPostRender:e(b,"UL")})),b.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:f(b)})};return{register:g}}),g("0",["1","2","3","4","5"],function(a,b,c,d,e){return a.add("lists",function(a){return d.setup(a),e.register(a),c.register(a),b.get(a)}),function(){}}),d("0")()}();
|
@@ -0,0 +1,2026 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.media.Plugin","tinymce.core.PluginManager","tinymce.plugins.media.api.Api","tinymce.plugins.media.api.Commands","tinymce.plugins.media.core.FilterContent","tinymce.plugins.media.core.ResolveName","tinymce.plugins.media.core.Selection","tinymce.plugins.media.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.media.ui.Dialog","tinymce.core.html.Node","tinymce.core.util.Tools","tinymce.plugins.media.core.Nodes","tinymce.plugins.media.core.Sanitize","tinymce.plugins.media.core.UpdateHtml","tinymce.core.Env","tinymce.plugins.media.api.Settings","tinymce.plugins.media.core.HtmlToData","tinymce.plugins.media.core.Service","tinymce.plugins.media.core.Size","tinymce.core.html.Writer","tinymce.core.html.SaxParser","tinymce.core.html.Schema","tinymce.core.dom.DOMUtils","tinymce.plugins.media.ui.SizeManager","tinymce.plugins.media.core.VideoScript","tinymce.core.util.Promise","tinymce.plugins.media.core.DataToHtml","tinymce.plugins.media.core.Mime","tinymce.plugins.media.core.UrlPatterns"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.PluginManager',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.PluginManager');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* ResolveGlobal.js
|
109
|
+
*
|
110
|
+
* Released under LGPL License.
|
111
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
112
|
+
*
|
113
|
+
* License: http://www.tinymce.com/license
|
114
|
+
* Contributing: http://www.tinymce.com/contributing
|
115
|
+
*/
|
116
|
+
|
117
|
+
define(
|
118
|
+
'tinymce.core.Env',
|
119
|
+
[
|
120
|
+
'global!tinymce.util.Tools.resolve'
|
121
|
+
],
|
122
|
+
function (resolve) {
|
123
|
+
return resolve('tinymce.Env');
|
124
|
+
}
|
125
|
+
);
|
126
|
+
|
127
|
+
/**
|
128
|
+
* ResolveGlobal.js
|
129
|
+
*
|
130
|
+
* Released under LGPL License.
|
131
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
132
|
+
*
|
133
|
+
* License: http://www.tinymce.com/license
|
134
|
+
* Contributing: http://www.tinymce.com/contributing
|
135
|
+
*/
|
136
|
+
|
137
|
+
define(
|
138
|
+
'tinymce.core.util.Tools',
|
139
|
+
[
|
140
|
+
'global!tinymce.util.Tools.resolve'
|
141
|
+
],
|
142
|
+
function (resolve) {
|
143
|
+
return resolve('tinymce.util.Tools');
|
144
|
+
}
|
145
|
+
);
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Settings.js
|
149
|
+
*
|
150
|
+
* Released under LGPL License.
|
151
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
152
|
+
*
|
153
|
+
* License: http://www.tinymce.com/license
|
154
|
+
* Contributing: http://www.tinymce.com/contributing
|
155
|
+
*/
|
156
|
+
|
157
|
+
define(
|
158
|
+
'tinymce.plugins.media.api.Settings',
|
159
|
+
[
|
160
|
+
],
|
161
|
+
function () {
|
162
|
+
var getScripts = function (editor) {
|
163
|
+
return editor.getParam('media_scripts');
|
164
|
+
};
|
165
|
+
|
166
|
+
var getAudioTemplateCallback = function (editor) {
|
167
|
+
return editor.getParam('audio_template_callback');
|
168
|
+
};
|
169
|
+
|
170
|
+
var getVideoTemplateCallback = function (editor) {
|
171
|
+
return editor.getParam('video_template_callback');
|
172
|
+
};
|
173
|
+
|
174
|
+
var hasLiveEmbeds = function (editor) {
|
175
|
+
return editor.getParam('media_live_embeds', true);
|
176
|
+
};
|
177
|
+
|
178
|
+
var shouldFilterHtml = function (editor) {
|
179
|
+
return editor.getParam('media_filter_html', true);
|
180
|
+
};
|
181
|
+
|
182
|
+
var getUrlResolver = function (editor) {
|
183
|
+
return editor.getParam('media_url_resolver');
|
184
|
+
};
|
185
|
+
|
186
|
+
var hasAltSource = function (editor) {
|
187
|
+
return editor.getParam('media_alt_source', true);
|
188
|
+
};
|
189
|
+
|
190
|
+
var hasPoster = function (editor) {
|
191
|
+
return editor.getParam('media_poster', true);
|
192
|
+
};
|
193
|
+
|
194
|
+
var hasDimensions = function (editor) {
|
195
|
+
return editor.getParam('media_dimensions', true);
|
196
|
+
};
|
197
|
+
|
198
|
+
return {
|
199
|
+
getScripts: getScripts,
|
200
|
+
getAudioTemplateCallback: getAudioTemplateCallback,
|
201
|
+
getVideoTemplateCallback: getVideoTemplateCallback,
|
202
|
+
hasLiveEmbeds: hasLiveEmbeds,
|
203
|
+
shouldFilterHtml: shouldFilterHtml,
|
204
|
+
getUrlResolver: getUrlResolver,
|
205
|
+
hasAltSource: hasAltSource,
|
206
|
+
hasPoster: hasPoster,
|
207
|
+
hasDimensions: hasDimensions
|
208
|
+
};
|
209
|
+
}
|
210
|
+
);
|
211
|
+
|
212
|
+
/**
|
213
|
+
* ResolveGlobal.js
|
214
|
+
*
|
215
|
+
* Released under LGPL License.
|
216
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
217
|
+
*
|
218
|
+
* License: http://www.tinymce.com/license
|
219
|
+
* Contributing: http://www.tinymce.com/contributing
|
220
|
+
*/
|
221
|
+
|
222
|
+
define(
|
223
|
+
'tinymce.core.html.SaxParser',
|
224
|
+
[
|
225
|
+
'global!tinymce.util.Tools.resolve'
|
226
|
+
],
|
227
|
+
function (resolve) {
|
228
|
+
return resolve('tinymce.html.SaxParser');
|
229
|
+
}
|
230
|
+
);
|
231
|
+
|
232
|
+
/**
|
233
|
+
* ResolveGlobal.js
|
234
|
+
*
|
235
|
+
* Released under LGPL License.
|
236
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
237
|
+
*
|
238
|
+
* License: http://www.tinymce.com/license
|
239
|
+
* Contributing: http://www.tinymce.com/contributing
|
240
|
+
*/
|
241
|
+
|
242
|
+
define(
|
243
|
+
'tinymce.core.html.Schema',
|
244
|
+
[
|
245
|
+
'global!tinymce.util.Tools.resolve'
|
246
|
+
],
|
247
|
+
function (resolve) {
|
248
|
+
return resolve('tinymce.html.Schema');
|
249
|
+
}
|
250
|
+
);
|
251
|
+
|
252
|
+
/**
|
253
|
+
* ResolveGlobal.js
|
254
|
+
*
|
255
|
+
* Released under LGPL License.
|
256
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
257
|
+
*
|
258
|
+
* License: http://www.tinymce.com/license
|
259
|
+
* Contributing: http://www.tinymce.com/contributing
|
260
|
+
*/
|
261
|
+
|
262
|
+
define(
|
263
|
+
'tinymce.core.dom.DOMUtils',
|
264
|
+
[
|
265
|
+
'global!tinymce.util.Tools.resolve'
|
266
|
+
],
|
267
|
+
function (resolve) {
|
268
|
+
return resolve('tinymce.dom.DOMUtils');
|
269
|
+
}
|
270
|
+
);
|
271
|
+
|
272
|
+
/**
|
273
|
+
* VideoScript.js
|
274
|
+
*
|
275
|
+
* Released under LGPL License.
|
276
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
277
|
+
*
|
278
|
+
* License: http://www.tinymce.com/license
|
279
|
+
* Contributing: http://www.tinymce.com/contributing
|
280
|
+
*/
|
281
|
+
|
282
|
+
define(
|
283
|
+
'tinymce.plugins.media.core.VideoScript',
|
284
|
+
[
|
285
|
+
],
|
286
|
+
function () {
|
287
|
+
var getVideoScriptMatch = function (prefixes, src) {
|
288
|
+
// var prefixes = Settings.getScripts(editor);
|
289
|
+
if (prefixes) {
|
290
|
+
for (var i = 0; i < prefixes.length; i++) {
|
291
|
+
if (src.indexOf(prefixes[i].filter) !== -1) {
|
292
|
+
return prefixes[i];
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
};
|
297
|
+
|
298
|
+
return {
|
299
|
+
getVideoScriptMatch: getVideoScriptMatch
|
300
|
+
};
|
301
|
+
}
|
302
|
+
);
|
303
|
+
/**
|
304
|
+
* Size.js
|
305
|
+
*
|
306
|
+
* Released under LGPL License.
|
307
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
308
|
+
*
|
309
|
+
* License: http://www.tinymce.com/license
|
310
|
+
* Contributing: http://www.tinymce.com/contributing
|
311
|
+
*/
|
312
|
+
|
313
|
+
define(
|
314
|
+
'tinymce.plugins.media.core.Size',
|
315
|
+
[
|
316
|
+
],
|
317
|
+
function () {
|
318
|
+
var trimPx = function (value) {
|
319
|
+
return value.replace(/px$/, '');
|
320
|
+
};
|
321
|
+
|
322
|
+
var addPx = function (value) {
|
323
|
+
return /^[0-9.]+$/.test(value) ? (value + 'px') : value;
|
324
|
+
};
|
325
|
+
|
326
|
+
var getSize = function (name) {
|
327
|
+
return function (elm) {
|
328
|
+
return elm ? trimPx(elm.style[name]) : '';
|
329
|
+
};
|
330
|
+
};
|
331
|
+
|
332
|
+
var setSize = function (name) {
|
333
|
+
return function (elm, value) {
|
334
|
+
if (elm) {
|
335
|
+
elm.style[name] = addPx(value);
|
336
|
+
}
|
337
|
+
};
|
338
|
+
};
|
339
|
+
|
340
|
+
return {
|
341
|
+
getMaxWidth: getSize('maxWidth'),
|
342
|
+
getMaxHeight: getSize('maxHeight'),
|
343
|
+
setMaxWidth: setSize('maxWidth'),
|
344
|
+
setMaxHeight: setSize('maxHeight')
|
345
|
+
};
|
346
|
+
}
|
347
|
+
);
|
348
|
+
/**
|
349
|
+
* HtmlToData.js
|
350
|
+
*
|
351
|
+
* Released under LGPL License.
|
352
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
353
|
+
*
|
354
|
+
* License: http://www.tinymce.com/license
|
355
|
+
* Contributing: http://www.tinymce.com/contributing
|
356
|
+
*/
|
357
|
+
|
358
|
+
define(
|
359
|
+
'tinymce.plugins.media.core.HtmlToData',
|
360
|
+
[
|
361
|
+
'tinymce.core.util.Tools',
|
362
|
+
'tinymce.core.html.SaxParser',
|
363
|
+
'tinymce.core.html.Schema',
|
364
|
+
'tinymce.core.dom.DOMUtils',
|
365
|
+
'tinymce.plugins.media.core.VideoScript',
|
366
|
+
'tinymce.plugins.media.core.Size'
|
367
|
+
],
|
368
|
+
function (Tools, SaxParser, Schema, DOMUtils, VideoScript, Size) {
|
369
|
+
var DOM = DOMUtils.DOM;
|
370
|
+
|
371
|
+
var getEphoxEmbedIri = function (elm) {
|
372
|
+
return DOM.getAttrib(elm, 'data-ephox-embed-iri');
|
373
|
+
};
|
374
|
+
|
375
|
+
var isEphoxEmbed = function (html) {
|
376
|
+
var fragment = DOM.createFragment(html);
|
377
|
+
return getEphoxEmbedIri(fragment.firstChild) !== '';
|
378
|
+
};
|
379
|
+
|
380
|
+
var htmlToDataSax = function (prefixes, html) {
|
381
|
+
var data = {};
|
382
|
+
|
383
|
+
new SaxParser({
|
384
|
+
validate: false,
|
385
|
+
allow_conditional_comments: true,
|
386
|
+
special: 'script,noscript',
|
387
|
+
start: function (name, attrs) {
|
388
|
+
if (!data.source1 && name === "param") {
|
389
|
+
data.source1 = attrs.map.movie;
|
390
|
+
}
|
391
|
+
|
392
|
+
if (name === "iframe" || name === "object" || name === "embed" || name === "video" || name === "audio") {
|
393
|
+
if (!data.type) {
|
394
|
+
data.type = name;
|
395
|
+
}
|
396
|
+
|
397
|
+
data = Tools.extend(attrs.map, data);
|
398
|
+
}
|
399
|
+
|
400
|
+
if (name === "script") {
|
401
|
+
var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src);
|
402
|
+
if (!videoScript) {
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
|
406
|
+
data = {
|
407
|
+
type: "script",
|
408
|
+
source1: attrs.map.src,
|
409
|
+
width: videoScript.width,
|
410
|
+
height: videoScript.height
|
411
|
+
};
|
412
|
+
}
|
413
|
+
|
414
|
+
if (name === "source") {
|
415
|
+
if (!data.source1) {
|
416
|
+
data.source1 = attrs.map.src;
|
417
|
+
} else if (!data.source2) {
|
418
|
+
data.source2 = attrs.map.src;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
422
|
+
if (name === "img" && !data.poster) {
|
423
|
+
data.poster = attrs.map.src;
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}).parse(html);
|
427
|
+
|
428
|
+
data.source1 = data.source1 || data.src || data.data;
|
429
|
+
data.source2 = data.source2 || '';
|
430
|
+
data.poster = data.poster || '';
|
431
|
+
|
432
|
+
return data;
|
433
|
+
};
|
434
|
+
|
435
|
+
var ephoxEmbedHtmlToData = function (html) {
|
436
|
+
var fragment = DOM.createFragment(html);
|
437
|
+
var div = fragment.firstChild;
|
438
|
+
|
439
|
+
return {
|
440
|
+
type: 'ephox-embed-iri',
|
441
|
+
source1: getEphoxEmbedIri(div),
|
442
|
+
source2: '',
|
443
|
+
poster: '',
|
444
|
+
width: Size.getMaxWidth(div),
|
445
|
+
height: Size.getMaxHeight(div)
|
446
|
+
};
|
447
|
+
};
|
448
|
+
|
449
|
+
var htmlToData = function (prefixes, html) {
|
450
|
+
return isEphoxEmbed(html) ? ephoxEmbedHtmlToData(html) : htmlToDataSax(prefixes, html);
|
451
|
+
};
|
452
|
+
|
453
|
+
return {
|
454
|
+
htmlToData: htmlToData
|
455
|
+
};
|
456
|
+
}
|
457
|
+
);
|
458
|
+
/**
|
459
|
+
* ResolveGlobal.js
|
460
|
+
*
|
461
|
+
* Released under LGPL License.
|
462
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
463
|
+
*
|
464
|
+
* License: http://www.tinymce.com/license
|
465
|
+
* Contributing: http://www.tinymce.com/contributing
|
466
|
+
*/
|
467
|
+
|
468
|
+
define(
|
469
|
+
'tinymce.core.util.Promise',
|
470
|
+
[
|
471
|
+
'global!tinymce.util.Tools.resolve'
|
472
|
+
],
|
473
|
+
function (resolve) {
|
474
|
+
return resolve('tinymce.util.Promise');
|
475
|
+
}
|
476
|
+
);
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Mime.js
|
480
|
+
*
|
481
|
+
* Released under LGPL License.
|
482
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
483
|
+
*
|
484
|
+
* License: http://www.tinymce.com/license
|
485
|
+
* Contributing: http://www.tinymce.com/contributing
|
486
|
+
*/
|
487
|
+
|
488
|
+
define(
|
489
|
+
'tinymce.plugins.media.core.Mime',
|
490
|
+
[
|
491
|
+
],
|
492
|
+
function () {
|
493
|
+
var guess = function (url) {
|
494
|
+
var mimes = {
|
495
|
+
'mp3': 'audio/mpeg',
|
496
|
+
'wav': 'audio/wav',
|
497
|
+
'mp4': 'video/mp4',
|
498
|
+
'webm': 'video/webm',
|
499
|
+
'ogg': 'video/ogg',
|
500
|
+
'swf': 'application/x-shockwave-flash'
|
501
|
+
};
|
502
|
+
var fileEnd = url.toLowerCase().split('.').pop();
|
503
|
+
var mime = mimes[fileEnd];
|
504
|
+
|
505
|
+
return mime ? mime : '';
|
506
|
+
};
|
507
|
+
|
508
|
+
return {
|
509
|
+
guess: guess
|
510
|
+
};
|
511
|
+
}
|
512
|
+
);
|
513
|
+
/**
|
514
|
+
* ResolveGlobal.js
|
515
|
+
*
|
516
|
+
* Released under LGPL License.
|
517
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
518
|
+
*
|
519
|
+
* License: http://www.tinymce.com/license
|
520
|
+
* Contributing: http://www.tinymce.com/contributing
|
521
|
+
*/
|
522
|
+
|
523
|
+
define(
|
524
|
+
'tinymce.core.html.Writer',
|
525
|
+
[
|
526
|
+
'global!tinymce.util.Tools.resolve'
|
527
|
+
],
|
528
|
+
function (resolve) {
|
529
|
+
return resolve('tinymce.html.Writer');
|
530
|
+
}
|
531
|
+
);
|
532
|
+
|
533
|
+
/**
|
534
|
+
* UpdateHtml.js
|
535
|
+
*
|
536
|
+
* Released under LGPL License.
|
537
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
538
|
+
*
|
539
|
+
* License: http://www.tinymce.com/license
|
540
|
+
* Contributing: http://www.tinymce.com/contributing
|
541
|
+
*/
|
542
|
+
|
543
|
+
define(
|
544
|
+
'tinymce.plugins.media.core.UpdateHtml',
|
545
|
+
[
|
546
|
+
'tinymce.core.html.Writer',
|
547
|
+
'tinymce.core.html.SaxParser',
|
548
|
+
'tinymce.core.html.Schema',
|
549
|
+
'tinymce.core.dom.DOMUtils',
|
550
|
+
'tinymce.plugins.media.core.Size'
|
551
|
+
],
|
552
|
+
function (Writer, SaxParser, Schema, DOMUtils, Size) {
|
553
|
+
var DOM = DOMUtils.DOM;
|
554
|
+
|
555
|
+
var setAttributes = function (attrs, updatedAttrs) {
|
556
|
+
var name;
|
557
|
+
var i;
|
558
|
+
var value;
|
559
|
+
var attr;
|
560
|
+
|
561
|
+
for (name in updatedAttrs) {
|
562
|
+
value = "" + updatedAttrs[name];
|
563
|
+
|
564
|
+
if (attrs.map[name]) {
|
565
|
+
i = attrs.length;
|
566
|
+
while (i--) {
|
567
|
+
attr = attrs[i];
|
568
|
+
|
569
|
+
if (attr.name === name) {
|
570
|
+
if (value) {
|
571
|
+
attrs.map[name] = value;
|
572
|
+
attr.value = value;
|
573
|
+
} else {
|
574
|
+
delete attrs.map[name];
|
575
|
+
attrs.splice(i, 1);
|
576
|
+
}
|
577
|
+
}
|
578
|
+
}
|
579
|
+
} else if (value) {
|
580
|
+
attrs.push({
|
581
|
+
name: name,
|
582
|
+
value: value
|
583
|
+
});
|
584
|
+
|
585
|
+
attrs.map[name] = value;
|
586
|
+
}
|
587
|
+
}
|
588
|
+
};
|
589
|
+
|
590
|
+
var normalizeHtml = function (html) {
|
591
|
+
var writer = new Writer();
|
592
|
+
var parser = new SaxParser(writer);
|
593
|
+
parser.parse(html);
|
594
|
+
return writer.getContent();
|
595
|
+
};
|
596
|
+
|
597
|
+
var updateHtmlSax = function (html, data, updateAll) {
|
598
|
+
var writer = new Writer();
|
599
|
+
var sourceCount = 0;
|
600
|
+
var hasImage;
|
601
|
+
|
602
|
+
new SaxParser({
|
603
|
+
validate: false,
|
604
|
+
allow_conditional_comments: true,
|
605
|
+
special: 'script,noscript',
|
606
|
+
|
607
|
+
comment: function (text) {
|
608
|
+
writer.comment(text);
|
609
|
+
},
|
610
|
+
|
611
|
+
cdata: function (text) {
|
612
|
+
writer.cdata(text);
|
613
|
+
},
|
614
|
+
|
615
|
+
text: function (text, raw) {
|
616
|
+
writer.text(text, raw);
|
617
|
+
},
|
618
|
+
|
619
|
+
start: function (name, attrs, empty) {
|
620
|
+
switch (name) {
|
621
|
+
case "video":
|
622
|
+
case "object":
|
623
|
+
case "embed":
|
624
|
+
case "img":
|
625
|
+
case "iframe":
|
626
|
+
if (data.height !== undefined && data.width !== undefined) {
|
627
|
+
setAttributes(attrs, {
|
628
|
+
width: data.width,
|
629
|
+
height: data.height
|
630
|
+
});
|
631
|
+
}
|
632
|
+
break;
|
633
|
+
}
|
634
|
+
|
635
|
+
if (updateAll) {
|
636
|
+
switch (name) {
|
637
|
+
case "video":
|
638
|
+
setAttributes(attrs, {
|
639
|
+
poster: data.poster,
|
640
|
+
src: ""
|
641
|
+
});
|
642
|
+
|
643
|
+
if (data.source2) {
|
644
|
+
setAttributes(attrs, {
|
645
|
+
src: ""
|
646
|
+
});
|
647
|
+
}
|
648
|
+
break;
|
649
|
+
|
650
|
+
case "iframe":
|
651
|
+
setAttributes(attrs, {
|
652
|
+
src: data.source1
|
653
|
+
});
|
654
|
+
break;
|
655
|
+
|
656
|
+
case "source":
|
657
|
+
sourceCount++;
|
658
|
+
|
659
|
+
if (sourceCount <= 2) {
|
660
|
+
setAttributes(attrs, {
|
661
|
+
src: data["source" + sourceCount],
|
662
|
+
type: data["source" + sourceCount + "mime"]
|
663
|
+
});
|
664
|
+
|
665
|
+
if (!data["source" + sourceCount]) {
|
666
|
+
return;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
break;
|
670
|
+
|
671
|
+
case "img":
|
672
|
+
if (!data.poster) {
|
673
|
+
return;
|
674
|
+
}
|
675
|
+
|
676
|
+
hasImage = true;
|
677
|
+
break;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
|
681
|
+
writer.start(name, attrs, empty);
|
682
|
+
},
|
683
|
+
|
684
|
+
end: function (name) {
|
685
|
+
if (name === "video" && updateAll) {
|
686
|
+
for (var index = 1; index <= 2; index++) {
|
687
|
+
if (data["source" + index]) {
|
688
|
+
var attrs = [];
|
689
|
+
attrs.map = {};
|
690
|
+
|
691
|
+
if (sourceCount < index) {
|
692
|
+
setAttributes(attrs, {
|
693
|
+
src: data["source" + index],
|
694
|
+
type: data["source" + index + "mime"]
|
695
|
+
});
|
696
|
+
|
697
|
+
writer.start("source", attrs, true);
|
698
|
+
}
|
699
|
+
}
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
703
|
+
if (data.poster && name === "object" && updateAll && !hasImage) {
|
704
|
+
var imgAttrs = [];
|
705
|
+
imgAttrs.map = {};
|
706
|
+
|
707
|
+
setAttributes(imgAttrs, {
|
708
|
+
src: data.poster,
|
709
|
+
width: data.width,
|
710
|
+
height: data.height
|
711
|
+
});
|
712
|
+
|
713
|
+
writer.start("img", imgAttrs, true);
|
714
|
+
}
|
715
|
+
|
716
|
+
writer.end(name);
|
717
|
+
}
|
718
|
+
}, new Schema({})).parse(html);
|
719
|
+
|
720
|
+
return writer.getContent();
|
721
|
+
};
|
722
|
+
|
723
|
+
var isEphoxEmbed = function (html) {
|
724
|
+
var fragment = DOM.createFragment(html);
|
725
|
+
return DOM.getAttrib(fragment.firstChild, 'data-ephox-embed-iri') !== '';
|
726
|
+
};
|
727
|
+
|
728
|
+
var updateEphoxEmbed = function (html, data) {
|
729
|
+
var fragment = DOM.createFragment(html);
|
730
|
+
var div = fragment.firstChild;
|
731
|
+
|
732
|
+
Size.setMaxWidth(div, data.width);
|
733
|
+
Size.setMaxHeight(div, data.height);
|
734
|
+
|
735
|
+
return normalizeHtml(div.outerHTML);
|
736
|
+
};
|
737
|
+
|
738
|
+
var updateHtml = function (html, data, updateAll) {
|
739
|
+
return isEphoxEmbed(html) ? updateEphoxEmbed(html, data) : updateHtmlSax(html, data, updateAll);
|
740
|
+
};
|
741
|
+
|
742
|
+
return {
|
743
|
+
updateHtml: updateHtml
|
744
|
+
};
|
745
|
+
}
|
746
|
+
);
|
747
|
+
/**
|
748
|
+
* UrlPatterns.js
|
749
|
+
*
|
750
|
+
* Released under LGPL License.
|
751
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
752
|
+
*
|
753
|
+
* License: http://www.tinymce.com/license
|
754
|
+
* Contributing: http://www.tinymce.com/contributing
|
755
|
+
*/
|
756
|
+
|
757
|
+
define(
|
758
|
+
'tinymce.plugins.media.core.UrlPatterns',
|
759
|
+
[
|
760
|
+
],
|
761
|
+
function () {
|
762
|
+
var urlPatterns = [
|
763
|
+
{
|
764
|
+
regex: /youtu\.be\/([\w\-.]+)/,
|
765
|
+
type: 'iframe', w: 560, h: 314,
|
766
|
+
url: '//www.youtube.com/embed/$1',
|
767
|
+
allowFullscreen: true
|
768
|
+
},
|
769
|
+
{
|
770
|
+
regex: /youtube\.com(.+)v=([^&]+)/,
|
771
|
+
type: 'iframe', w: 560, h: 314,
|
772
|
+
url: '//www.youtube.com/embed/$2',
|
773
|
+
allowFullscreen: true
|
774
|
+
},
|
775
|
+
{
|
776
|
+
regex: /youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i,
|
777
|
+
type: 'iframe', w: 560, h: 314,
|
778
|
+
url: '//www.youtube.com/embed/$1',
|
779
|
+
allowFullscreen: true
|
780
|
+
},
|
781
|
+
{
|
782
|
+
regex: /vimeo\.com\/([0-9]+)/,
|
783
|
+
type: 'iframe', w: 425, h: 350,
|
784
|
+
url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc',
|
785
|
+
allowfullscreen: true
|
786
|
+
},
|
787
|
+
{
|
788
|
+
regex: /vimeo\.com\/(.*)\/([0-9]+)/,
|
789
|
+
type: "iframe", w: 425, h: 350,
|
790
|
+
url: "//player.vimeo.com/video/$2?title=0&byline=0",
|
791
|
+
allowfullscreen: true
|
792
|
+
},
|
793
|
+
{
|
794
|
+
regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,
|
795
|
+
type: 'iframe', w: 425, h: 350,
|
796
|
+
url: '//maps.google.com/maps/ms?msid=$2&output=embed"',
|
797
|
+
allowFullscreen: false
|
798
|
+
},
|
799
|
+
{
|
800
|
+
regex: /dailymotion\.com\/video\/([^_]+)/,
|
801
|
+
type: 'iframe', w: 480, h: 270,
|
802
|
+
url: '//www.dailymotion.com/embed/video/$1',
|
803
|
+
allowFullscreen: true
|
804
|
+
},
|
805
|
+
{
|
806
|
+
regex: /dai\.ly\/([^_]+)/,
|
807
|
+
type: 'iframe', w: 480, h: 270,
|
808
|
+
url: '//www.dailymotion.com/embed/video/$1',
|
809
|
+
allowFullscreen: true
|
810
|
+
}
|
811
|
+
];
|
812
|
+
|
813
|
+
return {
|
814
|
+
urlPatterns: urlPatterns
|
815
|
+
};
|
816
|
+
}
|
817
|
+
);
|
818
|
+
/**
|
819
|
+
* DataToHtml.js
|
820
|
+
*
|
821
|
+
* Released under LGPL License.
|
822
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
823
|
+
*
|
824
|
+
* License: http://www.tinymce.com/license
|
825
|
+
* Contributing: http://www.tinymce.com/contributing
|
826
|
+
*/
|
827
|
+
|
828
|
+
define(
|
829
|
+
'tinymce.plugins.media.core.DataToHtml',
|
830
|
+
[
|
831
|
+
'tinymce.core.util.Tools',
|
832
|
+
'tinymce.plugins.media.api.Settings',
|
833
|
+
'tinymce.plugins.media.core.HtmlToData',
|
834
|
+
'tinymce.plugins.media.core.Mime',
|
835
|
+
'tinymce.plugins.media.core.UpdateHtml',
|
836
|
+
'tinymce.plugins.media.core.UrlPatterns',
|
837
|
+
'tinymce.plugins.media.core.VideoScript'
|
838
|
+
],
|
839
|
+
function (Tools, Settings, HtmlToData, Mime, UpdateHtml, UrlPatterns, VideoScript) {
|
840
|
+
var getIframeHtml = function (data) {
|
841
|
+
var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : '';
|
842
|
+
return '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"' + allowFullscreen + '></iframe>';
|
843
|
+
};
|
844
|
+
|
845
|
+
var getFlashHtml = function (data) {
|
846
|
+
var html = '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
|
847
|
+
|
848
|
+
if (data.poster) {
|
849
|
+
html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
|
850
|
+
}
|
851
|
+
|
852
|
+
html += '</object>';
|
853
|
+
|
854
|
+
return html;
|
855
|
+
};
|
856
|
+
|
857
|
+
var getAudioHtml = function (data, audioTemplateCallback) {
|
858
|
+
if (audioTemplateCallback) {
|
859
|
+
return audioTemplateCallback(data);
|
860
|
+
} else {
|
861
|
+
return (
|
862
|
+
'<audio controls="controls" src="' + data.source1 + '">' +
|
863
|
+
(
|
864
|
+
data.source2 ?
|
865
|
+
'\n<source src="' + data.source2 + '"' +
|
866
|
+
(data.source2mime ? ' type="' + data.source2mime + '"' : '') +
|
867
|
+
' />\n' : '') +
|
868
|
+
'</audio>'
|
869
|
+
);
|
870
|
+
}
|
871
|
+
};
|
872
|
+
|
873
|
+
var getVideoHtml = function (data, videoTemplateCallback) {
|
874
|
+
if (videoTemplateCallback) {
|
875
|
+
return videoTemplateCallback(data);
|
876
|
+
} else {
|
877
|
+
return (
|
878
|
+
'<video width="' + data.width +
|
879
|
+
'" height="' + data.height + '"' +
|
880
|
+
(data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
|
881
|
+
'<source src="' + data.source1 + '"' +
|
882
|
+
(data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
|
883
|
+
(data.source2 ? '<source src="' + data.source2 + '"' +
|
884
|
+
(data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
|
885
|
+
'</video>'
|
886
|
+
);
|
887
|
+
}
|
888
|
+
};
|
889
|
+
|
890
|
+
var getScriptHtml = function (data) {
|
891
|
+
return '<script src="' + data.source1 + '"></script>';
|
892
|
+
};
|
893
|
+
|
894
|
+
var dataToHtml = function (editor, dataIn) {
|
895
|
+
var data = Tools.extend({}, dataIn);
|
896
|
+
|
897
|
+
if (!data.source1) {
|
898
|
+
Tools.extend(data, HtmlToData.htmlToData(Settings.getScripts(editor), data.embed));
|
899
|
+
if (!data.source1) {
|
900
|
+
return '';
|
901
|
+
}
|
902
|
+
}
|
903
|
+
|
904
|
+
if (!data.source2) {
|
905
|
+
data.source2 = '';
|
906
|
+
}
|
907
|
+
|
908
|
+
if (!data.poster) {
|
909
|
+
data.poster = '';
|
910
|
+
}
|
911
|
+
|
912
|
+
data.source1 = editor.convertURL(data.source1, "source");
|
913
|
+
data.source2 = editor.convertURL(data.source2, "source");
|
914
|
+
data.source1mime = Mime.guess(data.source1);
|
915
|
+
data.source2mime = Mime.guess(data.source2);
|
916
|
+
data.poster = editor.convertURL(data.poster, "poster");
|
917
|
+
|
918
|
+
Tools.each(UrlPatterns.urlPatterns, function (pattern) {
|
919
|
+
var i;
|
920
|
+
var url;
|
921
|
+
|
922
|
+
var match = pattern.regex.exec(data.source1);
|
923
|
+
|
924
|
+
if (match) {
|
925
|
+
url = pattern.url;
|
926
|
+
|
927
|
+
for (i = 0; match[i]; i++) {
|
928
|
+
/*jshint loopfunc:true*/
|
929
|
+
/*eslint no-loop-func:0 */
|
930
|
+
url = url.replace('$' + i, function () {
|
931
|
+
return match[i];
|
932
|
+
});
|
933
|
+
}
|
934
|
+
|
935
|
+
data.source1 = url;
|
936
|
+
data.type = pattern.type;
|
937
|
+
data.allowFullscreen = pattern.allowFullscreen;
|
938
|
+
data.width = data.width || pattern.w;
|
939
|
+
data.height = data.height || pattern.h;
|
940
|
+
}
|
941
|
+
});
|
942
|
+
|
943
|
+
if (data.embed) {
|
944
|
+
return UpdateHtml.updateHtml(data.embed, data, true);
|
945
|
+
} else {
|
946
|
+
var videoScript = VideoScript.getVideoScriptMatch(Settings.getScripts(editor), data.source1);
|
947
|
+
if (videoScript) {
|
948
|
+
data.type = 'script';
|
949
|
+
data.width = videoScript.width;
|
950
|
+
data.height = videoScript.height;
|
951
|
+
}
|
952
|
+
|
953
|
+
var audioTemplateCallback = Settings.getAudioTemplateCallback(editor);
|
954
|
+
var videoTemplateCallback = Settings.getVideoTemplateCallback(editor);
|
955
|
+
|
956
|
+
data.width = data.width || 300;
|
957
|
+
data.height = data.height || 150;
|
958
|
+
|
959
|
+
Tools.each(data, function (value, key) {
|
960
|
+
data[key] = editor.dom.encode(value);
|
961
|
+
});
|
962
|
+
|
963
|
+
if (data.type === "iframe") {
|
964
|
+
return getIframeHtml(data);
|
965
|
+
} else if (data.source1mime === "application/x-shockwave-flash") {
|
966
|
+
return getFlashHtml(data);
|
967
|
+
} else if (data.source1mime.indexOf('audio') !== -1) {
|
968
|
+
return getAudioHtml(data, audioTemplateCallback);
|
969
|
+
} else if (data.type === "script") {
|
970
|
+
return getScriptHtml(data);
|
971
|
+
} else {
|
972
|
+
return getVideoHtml(data, videoTemplateCallback);
|
973
|
+
}
|
974
|
+
}
|
975
|
+
};
|
976
|
+
|
977
|
+
return {
|
978
|
+
dataToHtml: dataToHtml
|
979
|
+
};
|
980
|
+
}
|
981
|
+
);
|
982
|
+
/**
|
983
|
+
* Service.js
|
984
|
+
*
|
985
|
+
* Released under LGPL License.
|
986
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
987
|
+
*
|
988
|
+
* License: http://www.tinymce.com/license
|
989
|
+
* Contributing: http://www.tinymce.com/contributing
|
990
|
+
*/
|
991
|
+
|
992
|
+
define(
|
993
|
+
'tinymce.plugins.media.core.Service',
|
994
|
+
[
|
995
|
+
'tinymce.core.util.Promise',
|
996
|
+
'tinymce.plugins.media.api.Settings',
|
997
|
+
'tinymce.plugins.media.core.DataToHtml'
|
998
|
+
],
|
999
|
+
function (Promise, Settings, DataToHtml) {
|
1000
|
+
var cache = {};
|
1001
|
+
var embedPromise = function (data, dataToHtml, handler) {
|
1002
|
+
return new Promise(function (res, rej) {
|
1003
|
+
var wrappedResolve = function (response) {
|
1004
|
+
if (response.html) {
|
1005
|
+
cache[data.source1] = response;
|
1006
|
+
}
|
1007
|
+
return res({
|
1008
|
+
url: data.source1,
|
1009
|
+
html: response.html ? response.html : dataToHtml(data)
|
1010
|
+
});
|
1011
|
+
};
|
1012
|
+
if (cache[data.source1]) {
|
1013
|
+
wrappedResolve(cache[data.source1]);
|
1014
|
+
} else {
|
1015
|
+
handler({ url: data.source1 }, wrappedResolve, rej);
|
1016
|
+
}
|
1017
|
+
});
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
var defaultPromise = function (data, dataToHtml) {
|
1021
|
+
return new Promise(function (res) {
|
1022
|
+
res({ html: dataToHtml(data), url: data.source1 });
|
1023
|
+
});
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
var loadedData = function (editor) {
|
1027
|
+
return function (data) {
|
1028
|
+
return DataToHtml.dataToHtml(editor, data);
|
1029
|
+
};
|
1030
|
+
};
|
1031
|
+
|
1032
|
+
var getEmbedHtml = function (editor, data) {
|
1033
|
+
var embedHandler = Settings.getUrlResolver(editor);
|
1034
|
+
|
1035
|
+
return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor));
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
var isCached = function (url) {
|
1039
|
+
return cache.hasOwnProperty(url);
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
return {
|
1043
|
+
getEmbedHtml: getEmbedHtml,
|
1044
|
+
isCached: isCached
|
1045
|
+
};
|
1046
|
+
}
|
1047
|
+
);
|
1048
|
+
/**
|
1049
|
+
* SizeManager.js
|
1050
|
+
*
|
1051
|
+
* Released under LGPL License.
|
1052
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1053
|
+
*
|
1054
|
+
* License: http://www.tinymce.com/license
|
1055
|
+
* Contributing: http://www.tinymce.com/contributing
|
1056
|
+
*/
|
1057
|
+
|
1058
|
+
define(
|
1059
|
+
'tinymce.plugins.media.ui.SizeManager',
|
1060
|
+
[
|
1061
|
+
],
|
1062
|
+
function () {
|
1063
|
+
var doSyncSize = function (widthCtrl, heightCtrl) {
|
1064
|
+
widthCtrl.state.set('oldVal', widthCtrl.value());
|
1065
|
+
heightCtrl.state.set('oldVal', heightCtrl.value());
|
1066
|
+
};
|
1067
|
+
var doSizeControls = function (win, f) {
|
1068
|
+
var widthCtrl = win.find('#width')[0];
|
1069
|
+
var heightCtrl = win.find('#height')[0];
|
1070
|
+
var constrained = win.find('#constrain')[0];
|
1071
|
+
if (widthCtrl && heightCtrl && constrained) {
|
1072
|
+
f(widthCtrl, heightCtrl, constrained.checked());
|
1073
|
+
}
|
1074
|
+
};
|
1075
|
+
|
1076
|
+
var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
|
1077
|
+
var oldWidth = widthCtrl.state.get('oldVal');
|
1078
|
+
var oldHeight = heightCtrl.state.get('oldVal');
|
1079
|
+
var newWidth = widthCtrl.value();
|
1080
|
+
var newHeight = heightCtrl.value();
|
1081
|
+
|
1082
|
+
if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
|
1083
|
+
if (newWidth !== oldWidth) {
|
1084
|
+
newHeight = Math.round((newWidth / oldWidth) * newHeight);
|
1085
|
+
|
1086
|
+
if (!isNaN(newHeight)) {
|
1087
|
+
heightCtrl.value(newHeight);
|
1088
|
+
}
|
1089
|
+
} else {
|
1090
|
+
newWidth = Math.round((newHeight / oldHeight) * newWidth);
|
1091
|
+
|
1092
|
+
if (!isNaN(newWidth)) {
|
1093
|
+
widthCtrl.value(newWidth);
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
doSyncSize(widthCtrl, heightCtrl);
|
1099
|
+
};
|
1100
|
+
|
1101
|
+
var syncSize = function (win) {
|
1102
|
+
doSizeControls(win, doSyncSize);
|
1103
|
+
};
|
1104
|
+
|
1105
|
+
var updateSize = function (win) {
|
1106
|
+
doSizeControls(win, doUpdateSize);
|
1107
|
+
};
|
1108
|
+
|
1109
|
+
var createUi = function (onChange) {
|
1110
|
+
var recalcSize = function () {
|
1111
|
+
onChange(function (win) {
|
1112
|
+
updateSize(win);
|
1113
|
+
});
|
1114
|
+
};
|
1115
|
+
|
1116
|
+
return {
|
1117
|
+
type: 'container',
|
1118
|
+
label: 'Dimensions',
|
1119
|
+
layout: 'flex',
|
1120
|
+
align: 'center',
|
1121
|
+
spacing: 5,
|
1122
|
+
items: [
|
1123
|
+
{
|
1124
|
+
name: 'width', type: 'textbox', maxLength: 5, size: 5,
|
1125
|
+
onchange: recalcSize, ariaLabel: 'Width'
|
1126
|
+
},
|
1127
|
+
{ type: 'label', text: 'x' },
|
1128
|
+
{
|
1129
|
+
name: 'height', type: 'textbox', maxLength: 5, size: 5,
|
1130
|
+
onchange: recalcSize, ariaLabel: 'Height'
|
1131
|
+
},
|
1132
|
+
{ name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' }
|
1133
|
+
]
|
1134
|
+
};
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
return {
|
1138
|
+
createUi: createUi,
|
1139
|
+
syncSize: syncSize,
|
1140
|
+
updateSize: updateSize
|
1141
|
+
};
|
1142
|
+
}
|
1143
|
+
);
|
1144
|
+
/**
|
1145
|
+
* Dialog.js
|
1146
|
+
*
|
1147
|
+
* Released under LGPL License.
|
1148
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1149
|
+
*
|
1150
|
+
* License: http://www.tinymce.com/license
|
1151
|
+
* Contributing: http://www.tinymce.com/contributing
|
1152
|
+
*/
|
1153
|
+
|
1154
|
+
define(
|
1155
|
+
'tinymce.plugins.media.ui.Dialog',
|
1156
|
+
[
|
1157
|
+
'tinymce.core.Env',
|
1158
|
+
'tinymce.core.util.Tools',
|
1159
|
+
'tinymce.plugins.media.api.Settings',
|
1160
|
+
'tinymce.plugins.media.core.HtmlToData',
|
1161
|
+
'tinymce.plugins.media.core.Service',
|
1162
|
+
'tinymce.plugins.media.core.Size',
|
1163
|
+
'tinymce.plugins.media.core.UpdateHtml',
|
1164
|
+
'tinymce.plugins.media.ui.SizeManager'
|
1165
|
+
],
|
1166
|
+
function (Env, Tools, Settings, HtmlToData, Service, Size, UpdateHtml, SizeManager) {
|
1167
|
+
var embedChange = (Env.ie && Env.ie <= 8) ? 'onChange' : 'onInput';
|
1168
|
+
|
1169
|
+
var handleError = function (editor) {
|
1170
|
+
return function (error) {
|
1171
|
+
var errorMessage = error && error.msg ?
|
1172
|
+
'Media embed handler error: ' + error.msg :
|
1173
|
+
'Media embed handler threw unknown error.';
|
1174
|
+
editor.notificationManager.open({ type: 'error', text: errorMessage });
|
1175
|
+
};
|
1176
|
+
};
|
1177
|
+
|
1178
|
+
var getData = function (editor) {
|
1179
|
+
var element = editor.selection.getNode();
|
1180
|
+
var dataEmbed = element.getAttribute('data-ephox-embed-iri');
|
1181
|
+
|
1182
|
+
if (dataEmbed) {
|
1183
|
+
return {
|
1184
|
+
source1: dataEmbed,
|
1185
|
+
'data-ephox-embed-iri': dataEmbed,
|
1186
|
+
width: Size.getMaxWidth(element),
|
1187
|
+
height: Size.getMaxHeight(element)
|
1188
|
+
};
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
return element.getAttribute('data-mce-object') ?
|
1192
|
+
HtmlToData.htmlToData(Settings.getScripts(editor), editor.serializer.serialize(element, { selection: true })) :
|
1193
|
+
{};
|
1194
|
+
};
|
1195
|
+
|
1196
|
+
var getSource = function (editor) {
|
1197
|
+
var elm = editor.selection.getNode();
|
1198
|
+
|
1199
|
+
if (elm.getAttribute('data-mce-object') || elm.getAttribute('data-ephox-embed-iri')) {
|
1200
|
+
return editor.selection.getContent();
|
1201
|
+
}
|
1202
|
+
};
|
1203
|
+
|
1204
|
+
var addEmbedHtml = function (win, editor) {
|
1205
|
+
return function (response) {
|
1206
|
+
var html = response.html;
|
1207
|
+
var embed = win.find('#embed')[0];
|
1208
|
+
var data = Tools.extend(HtmlToData.htmlToData(Settings.getScripts(editor), html), { source1: response.url });
|
1209
|
+
win.fromJSON(data);
|
1210
|
+
|
1211
|
+
if (embed) {
|
1212
|
+
embed.value(html);
|
1213
|
+
SizeManager.updateSize(win);
|
1214
|
+
}
|
1215
|
+
};
|
1216
|
+
};
|
1217
|
+
|
1218
|
+
var selectPlaceholder = function (editor, beforeObjects) {
|
1219
|
+
var i;
|
1220
|
+
var y;
|
1221
|
+
var afterObjects = editor.dom.select('img[data-mce-object]');
|
1222
|
+
|
1223
|
+
// Find new image placeholder so we can select it
|
1224
|
+
for (i = 0; i < beforeObjects.length; i++) {
|
1225
|
+
for (y = afterObjects.length - 1; y >= 0; y--) {
|
1226
|
+
if (beforeObjects[i] === afterObjects[y]) {
|
1227
|
+
afterObjects.splice(y, 1);
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
editor.selection.select(afterObjects[0]);
|
1233
|
+
};
|
1234
|
+
|
1235
|
+
var handleInsert = function (editor, html) {
|
1236
|
+
var beforeObjects = editor.dom.select('img[data-mce-object]');
|
1237
|
+
|
1238
|
+
editor.insertContent(html);
|
1239
|
+
selectPlaceholder(editor, beforeObjects);
|
1240
|
+
editor.nodeChanged();
|
1241
|
+
};
|
1242
|
+
|
1243
|
+
var submitForm = function (win, editor) {
|
1244
|
+
var data = win.toJSON();
|
1245
|
+
|
1246
|
+
data.embed = UpdateHtml.updateHtml(data.embed, data);
|
1247
|
+
|
1248
|
+
if (data.embed && Service.isCached(data.source1)) {
|
1249
|
+
handleInsert(editor, data.embed);
|
1250
|
+
} else {
|
1251
|
+
Service.getEmbedHtml(editor, data)
|
1252
|
+
.then(function (response) {
|
1253
|
+
handleInsert(editor, response.html);
|
1254
|
+
})["catch"](handleError(editor));
|
1255
|
+
}
|
1256
|
+
};
|
1257
|
+
|
1258
|
+
var populateMeta = function (win, meta) {
|
1259
|
+
Tools.each(meta, function (value, key) {
|
1260
|
+
win.find('#' + key).value(value);
|
1261
|
+
});
|
1262
|
+
};
|
1263
|
+
|
1264
|
+
var showDialog = function (editor) {
|
1265
|
+
var win;
|
1266
|
+
var data;
|
1267
|
+
|
1268
|
+
var generalFormItems = [
|
1269
|
+
{
|
1270
|
+
name: 'source1',
|
1271
|
+
type: 'filepicker',
|
1272
|
+
filetype: 'media',
|
1273
|
+
size: 40,
|
1274
|
+
autofocus: true,
|
1275
|
+
label: 'Source',
|
1276
|
+
onpaste: function () {
|
1277
|
+
setTimeout(function () {
|
1278
|
+
Service.getEmbedHtml(editor, win.toJSON())
|
1279
|
+
.then(
|
1280
|
+
addEmbedHtml(win, editor)
|
1281
|
+
)["catch"](handleError(editor));
|
1282
|
+
}, 1);
|
1283
|
+
},
|
1284
|
+
onchange: function (e) {
|
1285
|
+
Service.getEmbedHtml(editor, win.toJSON())
|
1286
|
+
.then(
|
1287
|
+
addEmbedHtml(win, editor)
|
1288
|
+
)["catch"](handleError(editor));
|
1289
|
+
|
1290
|
+
populateMeta(win, e.meta);
|
1291
|
+
},
|
1292
|
+
onbeforecall: function (e) {
|
1293
|
+
e.meta = win.toJSON();
|
1294
|
+
}
|
1295
|
+
}
|
1296
|
+
];
|
1297
|
+
|
1298
|
+
var advancedFormItems = [];
|
1299
|
+
|
1300
|
+
var reserialise = function (update) {
|
1301
|
+
update(win);
|
1302
|
+
data = win.toJSON();
|
1303
|
+
win.find('#embed').value(UpdateHtml.updateHtml(data.embed, data));
|
1304
|
+
};
|
1305
|
+
|
1306
|
+
if (Settings.hasAltSource(editor)) {
|
1307
|
+
advancedFormItems.push({ name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source' });
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
if (Settings.hasPoster(editor)) {
|
1311
|
+
advancedFormItems.push({ name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster' });
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
if (Settings.hasDimensions(editor)) {
|
1315
|
+
var control = SizeManager.createUi(reserialise);
|
1316
|
+
generalFormItems.push(control);
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
data = getData(editor);
|
1320
|
+
|
1321
|
+
var embedTextBox = {
|
1322
|
+
id: 'mcemediasource',
|
1323
|
+
type: 'textbox',
|
1324
|
+
flex: 1,
|
1325
|
+
name: 'embed',
|
1326
|
+
value: getSource(editor),
|
1327
|
+
multiline: true,
|
1328
|
+
rows: 5,
|
1329
|
+
label: 'Source'
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
var updateValueOnChange = function () {
|
1333
|
+
data = Tools.extend({}, HtmlToData.htmlToData(Settings.getScripts(editor), this.value()));
|
1334
|
+
this.parent().parent().fromJSON(data);
|
1335
|
+
};
|
1336
|
+
|
1337
|
+
embedTextBox[embedChange] = updateValueOnChange;
|
1338
|
+
|
1339
|
+
win = editor.windowManager.open({
|
1340
|
+
title: 'Insert/edit media',
|
1341
|
+
data: data,
|
1342
|
+
bodyType: 'tabpanel',
|
1343
|
+
body: [
|
1344
|
+
{
|
1345
|
+
title: 'General',
|
1346
|
+
type: "form",
|
1347
|
+
items: generalFormItems
|
1348
|
+
},
|
1349
|
+
|
1350
|
+
{
|
1351
|
+
title: 'Embed',
|
1352
|
+
type: "container",
|
1353
|
+
layout: 'flex',
|
1354
|
+
direction: 'column',
|
1355
|
+
align: 'stretch',
|
1356
|
+
padding: 10,
|
1357
|
+
spacing: 10,
|
1358
|
+
items: [
|
1359
|
+
{
|
1360
|
+
type: 'label',
|
1361
|
+
text: 'Paste your embed code below:',
|
1362
|
+
forId: 'mcemediasource'
|
1363
|
+
},
|
1364
|
+
embedTextBox
|
1365
|
+
]
|
1366
|
+
},
|
1367
|
+
|
1368
|
+
{
|
1369
|
+
title: 'Advanced',
|
1370
|
+
type: "form",
|
1371
|
+
items: advancedFormItems
|
1372
|
+
}
|
1373
|
+
],
|
1374
|
+
onSubmit: function () {
|
1375
|
+
SizeManager.updateSize(win);
|
1376
|
+
submitForm(win, editor);
|
1377
|
+
}
|
1378
|
+
});
|
1379
|
+
|
1380
|
+
SizeManager.syncSize(win);
|
1381
|
+
};
|
1382
|
+
|
1383
|
+
return {
|
1384
|
+
showDialog: showDialog
|
1385
|
+
};
|
1386
|
+
}
|
1387
|
+
);
|
1388
|
+
/**
|
1389
|
+
* Api.js
|
1390
|
+
*
|
1391
|
+
* Released under LGPL License.
|
1392
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1393
|
+
*
|
1394
|
+
* License: http://www.tinymce.com/license
|
1395
|
+
* Contributing: http://www.tinymce.com/contributing
|
1396
|
+
*/
|
1397
|
+
|
1398
|
+
define(
|
1399
|
+
'tinymce.plugins.media.api.Api',
|
1400
|
+
[
|
1401
|
+
'tinymce.plugins.media.ui.Dialog'
|
1402
|
+
],
|
1403
|
+
function (Dialog) {
|
1404
|
+
var get = function (editor) {
|
1405
|
+
var showDialog = function () {
|
1406
|
+
Dialog.showDialog(editor);
|
1407
|
+
};
|
1408
|
+
|
1409
|
+
return {
|
1410
|
+
showDialog: showDialog
|
1411
|
+
};
|
1412
|
+
};
|
1413
|
+
|
1414
|
+
return {
|
1415
|
+
get: get
|
1416
|
+
};
|
1417
|
+
}
|
1418
|
+
);
|
1419
|
+
|
1420
|
+
|
1421
|
+
/**
|
1422
|
+
* Commands.js
|
1423
|
+
*
|
1424
|
+
* Released under LGPL License.
|
1425
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1426
|
+
*
|
1427
|
+
* License: http://www.tinymce.com/license
|
1428
|
+
* Contributing: http://www.tinymce.com/contributing
|
1429
|
+
*/
|
1430
|
+
|
1431
|
+
define(
|
1432
|
+
'tinymce.plugins.media.api.Commands',
|
1433
|
+
[
|
1434
|
+
'tinymce.plugins.media.ui.Dialog'
|
1435
|
+
],
|
1436
|
+
function (Dialog) {
|
1437
|
+
var register = function (editor) {
|
1438
|
+
var showDialog = function () {
|
1439
|
+
Dialog.showDialog(editor);
|
1440
|
+
};
|
1441
|
+
|
1442
|
+
editor.addCommand('mceMedia', showDialog);
|
1443
|
+
};
|
1444
|
+
|
1445
|
+
return {
|
1446
|
+
register: register
|
1447
|
+
};
|
1448
|
+
}
|
1449
|
+
);
|
1450
|
+
|
1451
|
+
|
1452
|
+
/**
|
1453
|
+
* ResolveGlobal.js
|
1454
|
+
*
|
1455
|
+
* Released under LGPL License.
|
1456
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1457
|
+
*
|
1458
|
+
* License: http://www.tinymce.com/license
|
1459
|
+
* Contributing: http://www.tinymce.com/contributing
|
1460
|
+
*/
|
1461
|
+
|
1462
|
+
define(
|
1463
|
+
'tinymce.core.html.Node',
|
1464
|
+
[
|
1465
|
+
'global!tinymce.util.Tools.resolve'
|
1466
|
+
],
|
1467
|
+
function (resolve) {
|
1468
|
+
return resolve('tinymce.html.Node');
|
1469
|
+
}
|
1470
|
+
);
|
1471
|
+
|
1472
|
+
/**
|
1473
|
+
* Sanitize.js
|
1474
|
+
*
|
1475
|
+
* Released under LGPL License.
|
1476
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1477
|
+
*
|
1478
|
+
* License: http://www.tinymce.com/license
|
1479
|
+
* Contributing: http://www.tinymce.com/contributing
|
1480
|
+
*/
|
1481
|
+
|
1482
|
+
define(
|
1483
|
+
'tinymce.plugins.media.core.Sanitize',
|
1484
|
+
[
|
1485
|
+
'tinymce.core.html.SaxParser',
|
1486
|
+
'tinymce.core.html.Schema',
|
1487
|
+
'tinymce.core.html.Writer',
|
1488
|
+
'tinymce.core.util.Tools',
|
1489
|
+
'tinymce.plugins.media.api.Settings'
|
1490
|
+
],
|
1491
|
+
function (SaxParser, Schema, Writer, Tools, Settings) {
|
1492
|
+
var sanitize = function (editor, html) {
|
1493
|
+
if (Settings.shouldFilterHtml(editor) === false) {
|
1494
|
+
return html;
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
var writer = new Writer();
|
1498
|
+
var blocked;
|
1499
|
+
|
1500
|
+
new SaxParser({
|
1501
|
+
validate: false,
|
1502
|
+
allow_conditional_comments: false,
|
1503
|
+
special: 'script,noscript',
|
1504
|
+
|
1505
|
+
comment: function (text) {
|
1506
|
+
writer.comment(text);
|
1507
|
+
},
|
1508
|
+
|
1509
|
+
cdata: function (text) {
|
1510
|
+
writer.cdata(text);
|
1511
|
+
},
|
1512
|
+
|
1513
|
+
text: function (text, raw) {
|
1514
|
+
writer.text(text, raw);
|
1515
|
+
},
|
1516
|
+
|
1517
|
+
start: function (name, attrs, empty) {
|
1518
|
+
blocked = true;
|
1519
|
+
|
1520
|
+
if (name === 'script' || name === 'noscript') {
|
1521
|
+
return;
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
for (var i = 0; i < attrs.length; i++) {
|
1525
|
+
if (attrs[i].name.indexOf('on') === 0) {
|
1526
|
+
return;
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
if (attrs[i].name === 'style') {
|
1530
|
+
attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
|
1531
|
+
}
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
writer.start(name, attrs, empty);
|
1535
|
+
blocked = false;
|
1536
|
+
},
|
1537
|
+
|
1538
|
+
end: function (name) {
|
1539
|
+
if (blocked) {
|
1540
|
+
return;
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
writer.end(name);
|
1544
|
+
}
|
1545
|
+
}, new Schema({})).parse(html);
|
1546
|
+
|
1547
|
+
return writer.getContent();
|
1548
|
+
};
|
1549
|
+
|
1550
|
+
return {
|
1551
|
+
sanitize: sanitize
|
1552
|
+
};
|
1553
|
+
}
|
1554
|
+
);
|
1555
|
+
/**
|
1556
|
+
* Nodes.js
|
1557
|
+
*
|
1558
|
+
* Released under LGPL License.
|
1559
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1560
|
+
*
|
1561
|
+
* License: http://www.tinymce.com/license
|
1562
|
+
* Contributing: http://www.tinymce.com/contributing
|
1563
|
+
*/
|
1564
|
+
|
1565
|
+
define(
|
1566
|
+
'tinymce.plugins.media.core.Nodes',
|
1567
|
+
[
|
1568
|
+
'tinymce.core.Env',
|
1569
|
+
'tinymce.core.html.Node',
|
1570
|
+
'tinymce.plugins.media.api.Settings',
|
1571
|
+
'tinymce.plugins.media.core.Sanitize',
|
1572
|
+
'tinymce.plugins.media.core.VideoScript'
|
1573
|
+
],
|
1574
|
+
function (Env, Node, Settings, Sanitize, VideoScript) {
|
1575
|
+
var createPlaceholderNode = function (editor, node) {
|
1576
|
+
var placeHolder;
|
1577
|
+
var name = node.name;
|
1578
|
+
|
1579
|
+
placeHolder = new Node('img', 1);
|
1580
|
+
placeHolder.shortEnded = true;
|
1581
|
+
|
1582
|
+
retainAttributesAndInnerHtml(editor, node, placeHolder);
|
1583
|
+
|
1584
|
+
placeHolder.attr({
|
1585
|
+
width: node.attr('width') || "300",
|
1586
|
+
height: node.attr('height') || (name === "audio" ? "30" : "150"),
|
1587
|
+
style: node.attr('style'),
|
1588
|
+
src: Env.transparentSrc,
|
1589
|
+
"data-mce-object": name,
|
1590
|
+
"class": "mce-object mce-object-" + name
|
1591
|
+
});
|
1592
|
+
|
1593
|
+
return placeHolder;
|
1594
|
+
};
|
1595
|
+
|
1596
|
+
var createPreviewIframeNode = function (editor, node) {
|
1597
|
+
var previewWrapper;
|
1598
|
+
var previewNode;
|
1599
|
+
var shimNode;
|
1600
|
+
var name = node.name;
|
1601
|
+
|
1602
|
+
previewWrapper = new Node('span', 1);
|
1603
|
+
previewWrapper.attr({
|
1604
|
+
contentEditable: 'false',
|
1605
|
+
style: node.attr('style'),
|
1606
|
+
"data-mce-object": name,
|
1607
|
+
"class": "mce-preview-object mce-object-" + name
|
1608
|
+
});
|
1609
|
+
|
1610
|
+
retainAttributesAndInnerHtml(editor, node, previewWrapper);
|
1611
|
+
|
1612
|
+
previewNode = new Node(name, 1);
|
1613
|
+
previewNode.attr({
|
1614
|
+
src: node.attr('src'),
|
1615
|
+
allowfullscreen: node.attr('allowfullscreen'),
|
1616
|
+
width: node.attr('width') || "300",
|
1617
|
+
height: node.attr('height') || (name === "audio" ? "30" : "150"),
|
1618
|
+
frameborder: '0'
|
1619
|
+
});
|
1620
|
+
|
1621
|
+
shimNode = new Node('span', 1);
|
1622
|
+
shimNode.attr('class', 'mce-shim');
|
1623
|
+
|
1624
|
+
previewWrapper.append(previewNode);
|
1625
|
+
previewWrapper.append(shimNode);
|
1626
|
+
|
1627
|
+
return previewWrapper;
|
1628
|
+
};
|
1629
|
+
|
1630
|
+
var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) {
|
1631
|
+
var attrName;
|
1632
|
+
var attrValue;
|
1633
|
+
var attribs;
|
1634
|
+
var ai;
|
1635
|
+
var innerHtml;
|
1636
|
+
|
1637
|
+
// Prefix all attributes except width, height and style since we
|
1638
|
+
// will add these to the placeholder
|
1639
|
+
attribs = sourceNode.attributes;
|
1640
|
+
ai = attribs.length;
|
1641
|
+
while (ai--) {
|
1642
|
+
attrName = attribs[ai].name;
|
1643
|
+
attrValue = attribs[ai].value;
|
1644
|
+
|
1645
|
+
if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
|
1646
|
+
if (attrName === "data" || attrName === "src") {
|
1647
|
+
attrValue = editor.convertURL(attrValue, attrName);
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
targetNode.attr('data-mce-p-' + attrName, attrValue);
|
1651
|
+
}
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
// Place the inner HTML contents inside an escaped attribute
|
1655
|
+
// This enables us to copy/paste the fake object
|
1656
|
+
innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
|
1657
|
+
if (innerHtml) {
|
1658
|
+
targetNode.attr("data-mce-html", escape(Sanitize.sanitize(editor, innerHtml)));
|
1659
|
+
targetNode.firstChild = null;
|
1660
|
+
}
|
1661
|
+
};
|
1662
|
+
|
1663
|
+
var isWithinEphoxEmbed = function (node) {
|
1664
|
+
while ((node = node.parent)) {
|
1665
|
+
if (node.attr('data-ephox-embed-iri')) {
|
1666
|
+
return true;
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
return false;
|
1671
|
+
};
|
1672
|
+
|
1673
|
+
var placeHolderConverter = function (editor) {
|
1674
|
+
return function (nodes) {
|
1675
|
+
var i = nodes.length;
|
1676
|
+
var node;
|
1677
|
+
var videoScript;
|
1678
|
+
|
1679
|
+
while (i--) {
|
1680
|
+
node = nodes[i];
|
1681
|
+
if (!node.parent) {
|
1682
|
+
continue;
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
if (node.parent.attr('data-mce-object')) {
|
1686
|
+
continue;
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
if (node.name === 'script') {
|
1690
|
+
videoScript = VideoScript.getVideoScriptMatch(Settings.getScripts(editor), node.attr('src'));
|
1691
|
+
if (!videoScript) {
|
1692
|
+
continue;
|
1693
|
+
}
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
if (videoScript) {
|
1697
|
+
if (videoScript.width) {
|
1698
|
+
node.attr('width', videoScript.width.toString());
|
1699
|
+
}
|
1700
|
+
|
1701
|
+
if (videoScript.height) {
|
1702
|
+
node.attr('height', videoScript.height.toString());
|
1703
|
+
}
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
if (node.name === 'iframe' && Settings.hasLiveEmbeds(editor) && Env.ceFalse) {
|
1707
|
+
if (!isWithinEphoxEmbed(node)) {
|
1708
|
+
node.replace(createPreviewIframeNode(editor, node));
|
1709
|
+
}
|
1710
|
+
} else {
|
1711
|
+
if (!isWithinEphoxEmbed(node)) {
|
1712
|
+
node.replace(createPlaceholderNode(editor, node));
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
};
|
1717
|
+
};
|
1718
|
+
|
1719
|
+
return {
|
1720
|
+
createPreviewIframeNode: createPreviewIframeNode,
|
1721
|
+
createPlaceholderNode: createPlaceholderNode,
|
1722
|
+
placeHolderConverter: placeHolderConverter
|
1723
|
+
};
|
1724
|
+
}
|
1725
|
+
);
|
1726
|
+
/**
|
1727
|
+
* FilterContent.js
|
1728
|
+
*
|
1729
|
+
* Released under LGPL License.
|
1730
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1731
|
+
*
|
1732
|
+
* License: http://www.tinymce.com/license
|
1733
|
+
* Contributing: http://www.tinymce.com/contributing
|
1734
|
+
*/
|
1735
|
+
|
1736
|
+
define(
|
1737
|
+
'tinymce.plugins.media.core.FilterContent',
|
1738
|
+
[
|
1739
|
+
'tinymce.core.html.Node',
|
1740
|
+
'tinymce.core.util.Tools',
|
1741
|
+
'tinymce.plugins.media.core.Nodes',
|
1742
|
+
'tinymce.plugins.media.core.Sanitize'
|
1743
|
+
],
|
1744
|
+
function (Node, Tools, Nodes, Sanitize) {
|
1745
|
+
var setup = function (editor) {
|
1746
|
+
editor.on('preInit', function () {
|
1747
|
+
// Make sure that any messy HTML is retained inside these
|
1748
|
+
var specialElements = editor.schema.getSpecialElements();
|
1749
|
+
Tools.each('video audio iframe object'.split(' '), function (name) {
|
1750
|
+
specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
|
1751
|
+
});
|
1752
|
+
|
1753
|
+
// Allow elements
|
1754
|
+
//editor.schema.addValidElements(
|
1755
|
+
// 'object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]'
|
1756
|
+
//);
|
1757
|
+
|
1758
|
+
// Set allowFullscreen attribs as boolean
|
1759
|
+
var boolAttrs = editor.schema.getBoolAttrs();
|
1760
|
+
Tools.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) {
|
1761
|
+
boolAttrs[name] = {};
|
1762
|
+
});
|
1763
|
+
|
1764
|
+
// Converts iframe, video etc into placeholder images
|
1765
|
+
editor.parser.addNodeFilter('iframe,video,audio,object,embed,script',
|
1766
|
+
Nodes.placeHolderConverter(editor));
|
1767
|
+
|
1768
|
+
// Replaces placeholder images with real elements for video, object, iframe etc
|
1769
|
+
editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) {
|
1770
|
+
var i = nodes.length;
|
1771
|
+
var node;
|
1772
|
+
var realElm;
|
1773
|
+
var ai;
|
1774
|
+
var attribs;
|
1775
|
+
var innerHtml;
|
1776
|
+
var innerNode;
|
1777
|
+
var realElmName;
|
1778
|
+
var className;
|
1779
|
+
|
1780
|
+
while (i--) {
|
1781
|
+
node = nodes[i];
|
1782
|
+
if (!node.parent) {
|
1783
|
+
continue;
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
realElmName = node.attr(name);
|
1787
|
+
realElm = new Node(realElmName, 1);
|
1788
|
+
|
1789
|
+
// Add width/height to everything but audio
|
1790
|
+
if (realElmName !== "audio" && realElmName !== "script") {
|
1791
|
+
className = node.attr('class');
|
1792
|
+
if (className && className.indexOf('mce-preview-object') !== -1) {
|
1793
|
+
realElm.attr({
|
1794
|
+
width: node.firstChild.attr('width'),
|
1795
|
+
height: node.firstChild.attr('height')
|
1796
|
+
});
|
1797
|
+
} else {
|
1798
|
+
realElm.attr({
|
1799
|
+
width: node.attr('width'),
|
1800
|
+
height: node.attr('height')
|
1801
|
+
});
|
1802
|
+
}
|
1803
|
+
}
|
1804
|
+
|
1805
|
+
realElm.attr({
|
1806
|
+
style: node.attr('style')
|
1807
|
+
});
|
1808
|
+
|
1809
|
+
// Unprefix all placeholder attributes
|
1810
|
+
attribs = node.attributes;
|
1811
|
+
ai = attribs.length;
|
1812
|
+
while (ai--) {
|
1813
|
+
var attrName = attribs[ai].name;
|
1814
|
+
|
1815
|
+
if (attrName.indexOf('data-mce-p-') === 0) {
|
1816
|
+
realElm.attr(attrName.substr(11), attribs[ai].value);
|
1817
|
+
}
|
1818
|
+
}
|
1819
|
+
|
1820
|
+
if (realElmName === "script") {
|
1821
|
+
realElm.attr('type', 'text/javascript');
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
// Inject innerhtml
|
1825
|
+
innerHtml = node.attr('data-mce-html');
|
1826
|
+
if (innerHtml) {
|
1827
|
+
innerNode = new Node('#text', 3);
|
1828
|
+
innerNode.raw = true;
|
1829
|
+
innerNode.value = Sanitize.sanitize(editor, unescape(innerHtml));
|
1830
|
+
realElm.append(innerNode);
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
node.replace(realElm);
|
1834
|
+
}
|
1835
|
+
});
|
1836
|
+
});
|
1837
|
+
|
1838
|
+
editor.on('setContent', function () {
|
1839
|
+
// TODO: This shouldn't be needed there should be a way to mark bogus
|
1840
|
+
// elements so they are never removed except external save
|
1841
|
+
editor.$('span.mce-preview-object').each(function (index, elm) {
|
1842
|
+
var $elm = editor.$(elm);
|
1843
|
+
|
1844
|
+
if ($elm.find('span.mce-shim', elm).length === 0) {
|
1845
|
+
$elm.append('<span class="mce-shim"></span>');
|
1846
|
+
}
|
1847
|
+
});
|
1848
|
+
});
|
1849
|
+
};
|
1850
|
+
|
1851
|
+
return {
|
1852
|
+
setup: setup
|
1853
|
+
};
|
1854
|
+
}
|
1855
|
+
);
|
1856
|
+
|
1857
|
+
|
1858
|
+
/**
|
1859
|
+
* ResolveName.js
|
1860
|
+
*
|
1861
|
+
* Released under LGPL License.
|
1862
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1863
|
+
*
|
1864
|
+
* License: http://www.tinymce.com/license
|
1865
|
+
* Contributing: http://www.tinymce.com/contributing
|
1866
|
+
*/
|
1867
|
+
|
1868
|
+
define(
|
1869
|
+
'tinymce.plugins.media.core.ResolveName',
|
1870
|
+
[
|
1871
|
+
],
|
1872
|
+
function () {
|
1873
|
+
var setup = function (editor) {
|
1874
|
+
editor.on('ResolveName', function (e) {
|
1875
|
+
var name;
|
1876
|
+
|
1877
|
+
if (e.target.nodeType === 1 && (name = e.target.getAttribute("data-mce-object"))) {
|
1878
|
+
e.name = name;
|
1879
|
+
}
|
1880
|
+
});
|
1881
|
+
};
|
1882
|
+
|
1883
|
+
return {
|
1884
|
+
setup: setup
|
1885
|
+
};
|
1886
|
+
}
|
1887
|
+
);
|
1888
|
+
|
1889
|
+
|
1890
|
+
/**
|
1891
|
+
* Selection.js
|
1892
|
+
*
|
1893
|
+
* Released under LGPL License.
|
1894
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1895
|
+
*
|
1896
|
+
* License: http://www.tinymce.com/license
|
1897
|
+
* Contributing: http://www.tinymce.com/contributing
|
1898
|
+
*/
|
1899
|
+
|
1900
|
+
define(
|
1901
|
+
'tinymce.plugins.media.core.Selection',
|
1902
|
+
[
|
1903
|
+
'tinymce.plugins.media.core.UpdateHtml'
|
1904
|
+
],
|
1905
|
+
function (UpdateHtml) {
|
1906
|
+
var setup = function (editor) {
|
1907
|
+
editor.on('click keyup', function () {
|
1908
|
+
var selectedNode = editor.selection.getNode();
|
1909
|
+
|
1910
|
+
if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
|
1911
|
+
if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
|
1912
|
+
selectedNode.setAttribute('data-mce-selected', '2');
|
1913
|
+
}
|
1914
|
+
}
|
1915
|
+
});
|
1916
|
+
|
1917
|
+
editor.on('ObjectSelected', function (e) {
|
1918
|
+
var objectType = e.target.getAttribute('data-mce-object');
|
1919
|
+
|
1920
|
+
if (objectType === "audio" || objectType === "script") {
|
1921
|
+
e.preventDefault();
|
1922
|
+
}
|
1923
|
+
});
|
1924
|
+
|
1925
|
+
editor.on('objectResized', function (e) {
|
1926
|
+
var target = e.target;
|
1927
|
+
var html;
|
1928
|
+
|
1929
|
+
if (target.getAttribute('data-mce-object')) {
|
1930
|
+
html = target.getAttribute('data-mce-html');
|
1931
|
+
if (html) {
|
1932
|
+
html = unescape(html);
|
1933
|
+
target.setAttribute('data-mce-html', escape(
|
1934
|
+
UpdateHtml.updateHtml(html, {
|
1935
|
+
width: e.width,
|
1936
|
+
height: e.height
|
1937
|
+
})
|
1938
|
+
));
|
1939
|
+
}
|
1940
|
+
}
|
1941
|
+
});
|
1942
|
+
};
|
1943
|
+
|
1944
|
+
return {
|
1945
|
+
setup: setup
|
1946
|
+
};
|
1947
|
+
}
|
1948
|
+
);
|
1949
|
+
|
1950
|
+
|
1951
|
+
/**
|
1952
|
+
* Buttons.js
|
1953
|
+
*
|
1954
|
+
* Released under LGPL License.
|
1955
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1956
|
+
*
|
1957
|
+
* License: http://www.tinymce.com/license
|
1958
|
+
* Contributing: http://www.tinymce.com/contributing
|
1959
|
+
*/
|
1960
|
+
|
1961
|
+
define(
|
1962
|
+
'tinymce.plugins.media.ui.Buttons',
|
1963
|
+
[
|
1964
|
+
],
|
1965
|
+
function () {
|
1966
|
+
var register = function (editor) {
|
1967
|
+
editor.addButton('media', {
|
1968
|
+
tooltip: 'Insert/edit media',
|
1969
|
+
cmd: 'mceMedia',
|
1970
|
+
stateSelector: ['img[data-mce-object]', 'span[data-mce-object]', 'div[data-ephox-embed-iri]']
|
1971
|
+
});
|
1972
|
+
|
1973
|
+
editor.addMenuItem('media', {
|
1974
|
+
icon: 'media',
|
1975
|
+
text: 'Media',
|
1976
|
+
cmd: 'mceMedia',
|
1977
|
+
context: 'insert',
|
1978
|
+
prependToContext: true
|
1979
|
+
});
|
1980
|
+
};
|
1981
|
+
|
1982
|
+
return {
|
1983
|
+
register: register
|
1984
|
+
};
|
1985
|
+
}
|
1986
|
+
);
|
1987
|
+
|
1988
|
+
|
1989
|
+
/**
|
1990
|
+
* Plugin.js
|
1991
|
+
*
|
1992
|
+
* Released under LGPL License.
|
1993
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
1994
|
+
*
|
1995
|
+
* License: http://www.tinymce.com/license
|
1996
|
+
* Contributing: http://www.tinymce.com/contributing
|
1997
|
+
*/
|
1998
|
+
|
1999
|
+
define(
|
2000
|
+
'tinymce.plugins.media.Plugin',
|
2001
|
+
[
|
2002
|
+
'tinymce.core.PluginManager',
|
2003
|
+
'tinymce.plugins.media.api.Api',
|
2004
|
+
'tinymce.plugins.media.api.Commands',
|
2005
|
+
'tinymce.plugins.media.core.FilterContent',
|
2006
|
+
'tinymce.plugins.media.core.ResolveName',
|
2007
|
+
'tinymce.plugins.media.core.Selection',
|
2008
|
+
'tinymce.plugins.media.ui.Buttons'
|
2009
|
+
],
|
2010
|
+
function (PluginManager, Api, Commands, FilterContent, ResolveName, Selection, Buttons) {
|
2011
|
+
PluginManager.add('media', function (editor) {
|
2012
|
+
Commands.register(editor);
|
2013
|
+
Buttons.register(editor);
|
2014
|
+
ResolveName.setup(editor);
|
2015
|
+
FilterContent.setup(editor);
|
2016
|
+
Selection.setup(editor);
|
2017
|
+
return Api.get(editor);
|
2018
|
+
});
|
2019
|
+
|
2020
|
+
return function () { };
|
2021
|
+
}
|
2022
|
+
);
|
2023
|
+
|
2024
|
+
|
2025
|
+
dem('tinymce.plugins.media.Plugin')();
|
2026
|
+
})();
|