?charmap/plugin.js000064400000055252147331520370010031 0ustar00(function () { var charmap = (function () { 'use strict'; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var fireInsertCustomChar = function (editor, chr) { return editor.fire('insertCustomChar', { chr: chr }); }; var Events = { fireInsertCustomChar: fireInsertCustomChar }; var insertChar = function (editor, chr) { var evtChr = Events.fireInsertCustomChar(editor, chr).chr; editor.execCommand('mceInsertContent', false, evtChr); }; var Actions = { insertChar: insertChar }; var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var getCharMap = function (editor) { return editor.settings.charmap; }; var getCharMapAppend = function (editor) { return editor.settings.charmap_append; }; var Settings = { getCharMap: getCharMap, getCharMapAppend: getCharMapAppend }; var isArray = global$1.isArray; var getDefaultCharMap = function () { return [ [ '160', 'no-break space' ], [ '173', 'soft hyphen' ], [ '34', 'quotation mark' ], [ '162', 'cent sign' ], [ '8364', 'euro sign' ], [ '163', 'pound sign' ], [ '165', 'yen sign' ], [ '169', 'copyright sign' ], [ '174', 'registered sign' ], [ '8482', 'trade mark sign' ], [ '8240', 'per mille sign' ], [ '181', 'micro sign' ], [ '183', 'middle dot' ], [ '8226', 'bullet' ], [ '8230', 'three dot leader' ], [ '8242', 'minutes / feet' ], [ '8243', 'seconds / inches' ], [ '167', 'section sign' ], [ '182', 'paragraph sign' ], [ '223', 'sharp s / ess-zed' ], [ '8249', 'single left-pointing angle quotation mark' ], [ '8250', 'single right-pointing angle quotation mark' ], [ '171', 'left pointing guillemet' ], [ '187', 'right pointing guillemet' ], [ '8216', 'left single quotation mark' ], [ '8217', 'right single quotation mark' ], [ '8220', 'left double quotation mark' ], [ '8221', 'right double quotation mark' ], [ '8218', 'single low-9 quotation mark' ], [ '8222', 'double low-9 quotation mark' ], [ '60', 'less-than sign' ], [ '62', 'greater-than sign' ], [ '8804', 'less-than or equal to' ], [ '8805', 'greater-than or equal to' ], [ '8211', 'en dash' ], [ '8212', 'em dash' ], [ '175', 'macron' ], [ '8254', 'overline' ], [ '164', 'currency sign' ], [ '166', 'broken bar' ], [ '168', 'diaeresis' ], [ '161', 'inverted exclamation mark' ], [ '191', 'turned question mark' ], [ '710', 'circumflex accent' ], [ '732', 'small tilde' ], [ '176', 'degree sign' ], [ '8722', 'minus sign' ], [ '177', 'plus-minus sign' ], [ '247', 'division sign' ], [ '8260', 'fraction slash' ], [ '215', 'multiplication sign' ], [ '185', 'superscript one' ], [ '178', 'superscript two' ], [ '179', 'superscript three' ], [ '188', 'fraction one quarter' ], [ '189', 'fraction one half' ], [ '190', 'fraction three quarters' ], [ '402', 'function / florin' ], [ '8747', 'integral' ], [ '8721', 'n-ary sumation' ], [ '8734', 'infinity' ], [ '8730', 'square root' ], [ '8764', 'similar to' ], [ '8773', 'approximately equal to' ], [ '8776', 'almost equal to' ], [ '8800', 'not equal to' ], [ '8801', 'identical to' ], [ '8712', 'element of' ], [ '8713', 'not an element of' ], [ '8715', 'contains as member' ], [ '8719', 'n-ary product' ], [ '8743', 'logical and' ], [ '8744', 'logical or' ], [ '172', 'not sign' ], [ '8745', 'intersection' ], [ '8746', 'union' ], [ '8706', 'partial differential' ], [ '8704', 'for all' ], [ '8707', 'there exists' ], [ '8709', 'diameter' ], [ '8711', 'backward difference' ], [ '8727', 'asterisk operator' ], [ '8733', 'proportional to' ], [ '8736', 'angle' ], [ '180', 'acute accent' ], [ '184', 'cedilla' ], [ '170', 'feminine ordinal indicator' ], [ '186', 'masculine ordinal indicator' ], [ '8224', 'dagger' ], [ '8225', 'double dagger' ], [ '192', 'A - grave' ], [ '193', 'A - acute' ], [ '194', 'A - circumflex' ], [ '195', 'A - tilde' ], [ '196', 'A - diaeresis' ], [ '197', 'A - ring above' ], [ '256', 'A - macron' ], [ '198', 'ligature AE' ], [ '199', 'C - cedilla' ], [ '200', 'E - grave' ], [ '201', 'E - acute' ], [ '202', 'E - circumflex' ], [ '203', 'E - diaeresis' ], [ '274', 'E - macron' ], [ '204', 'I - grave' ], [ '205', 'I - acute' ], [ '206', 'I - circumflex' ], [ '207', 'I - diaeresis' ], [ '298', 'I - macron' ], [ '208', 'ETH' ], [ '209', 'N - tilde' ], [ '210', 'O - grave' ], [ '211', 'O - acute' ], [ '212', 'O - circumflex' ], [ '213', 'O - tilde' ], [ '214', 'O - diaeresis' ], [ '216', 'O - slash' ], [ '332', 'O - macron' ], [ '338', 'ligature OE' ], [ '352', 'S - caron' ], [ '217', 'U - grave' ], [ '218', 'U - acute' ], [ '219', 'U - circumflex' ], [ '220', 'U - diaeresis' ], [ '362', 'U - macron' ], [ '221', 'Y - acute' ], [ '376', 'Y - diaeresis' ], [ '562', 'Y - macron' ], [ '222', 'THORN' ], [ '224', 'a - grave' ], [ '225', 'a - acute' ], [ '226', 'a - circumflex' ], [ '227', 'a - tilde' ], [ '228', 'a - diaeresis' ], [ '229', 'a - ring above' ], [ '257', 'a - macron' ], [ '230', 'ligature ae' ], [ '231', 'c - cedilla' ], [ '232', 'e - grave' ], [ '233', 'e - acute' ], [ '234', 'e - circumflex' ], [ '235', 'e - diaeresis' ], [ '275', 'e - macron' ], [ '236', 'i - grave' ], [ '237', 'i - acute' ], [ '238', 'i - circumflex' ], [ '239', 'i - diaeresis' ], [ '299', 'i - macron' ], [ '240', 'eth' ], [ '241', 'n - tilde' ], [ '242', 'o - grave' ], [ '243', 'o - acute' ], [ '244', 'o - circumflex' ], [ '245', 'o - tilde' ], [ '246', 'o - diaeresis' ], [ '248', 'o slash' ], [ '333', 'o macron' ], [ '339', 'ligature oe' ], [ '353', 's - caron' ], [ '249', 'u - grave' ], [ '250', 'u - acute' ], [ '251', 'u - circumflex' ], [ '252', 'u - diaeresis' ], [ '363', 'u - macron' ], [ '253', 'y - acute' ], [ '254', 'thorn' ], [ '255', 'y - diaeresis' ], [ '563', 'y - macron' ], [ '913', 'Alpha' ], [ '914', 'Beta' ], [ '915', 'Gamma' ], [ '916', 'Delta' ], [ '917', 'Epsilon' ], [ '918', 'Zeta' ], [ '919', 'Eta' ], [ '920', 'Theta' ], [ '921', 'Iota' ], [ '922', 'Kappa' ], [ '923', 'Lambda' ], [ '924', 'Mu' ], [ '925', 'Nu' ], [ '926', 'Xi' ], [ '927', 'Omicron' ], [ '928', 'Pi' ], [ '929', 'Rho' ], [ '931', 'Sigma' ], [ '932', 'Tau' ], [ '933', 'Upsilon' ], [ '934', 'Phi' ], [ '935', 'Chi' ], [ '936', 'Psi' ], [ '937', 'Omega' ], [ '945', 'alpha' ], [ '946', 'beta' ], [ '947', 'gamma' ], [ '948', 'delta' ], [ '949', 'epsilon' ], [ '950', 'zeta' ], [ '951', 'eta' ], [ '952', 'theta' ], [ '953', 'iota' ], [ '954', 'kappa' ], [ '955', 'lambda' ], [ '956', 'mu' ], [ '957', 'nu' ], [ '958', 'xi' ], [ '959', 'omicron' ], [ '960', 'pi' ], [ '961', 'rho' ], [ '962', 'final sigma' ], [ '963', 'sigma' ], [ '964', 'tau' ], [ '965', 'upsilon' ], [ '966', 'phi' ], [ '967', 'chi' ], [ '968', 'psi' ], [ '969', 'omega' ], [ '8501', 'alef symbol' ], [ '982', 'pi symbol' ], [ '8476', 'real part symbol' ], [ '978', 'upsilon - hook symbol' ], [ '8472', 'Weierstrass p' ], [ '8465', 'imaginary part' ], [ '8592', 'leftwards arrow' ], [ '8593', 'upwards arrow' ], [ '8594', 'rightwards arrow' ], [ '8595', 'downwards arrow' ], [ '8596', 'left right arrow' ], [ '8629', 'carriage return' ], [ '8656', 'leftwards double arrow' ], [ '8657', 'upwards double arrow' ], [ '8658', 'rightwards double arrow' ], [ '8659', 'downwards double arrow' ], [ '8660', 'left right double arrow' ], [ '8756', 'therefore' ], [ '8834', 'subset of' ], [ '8835', 'superset of' ], [ '8836', 'not a subset of' ], [ '8838', 'subset of or equal to' ], [ '8839', 'superset of or equal to' ], [ '8853', 'circled plus' ], [ '8855', 'circled times' ], [ '8869', 'perpendicular' ], [ '8901', 'dot operator' ], [ '8968', 'left ceiling' ], [ '8969', 'right ceiling' ], [ '8970', 'left floor' ], [ '8971', 'right floor' ], [ '9001', 'left-pointing angle bracket' ], [ '9002', 'right-pointing angle bracket' ], [ '9674', 'lozenge' ], [ '9824', 'black spade suit' ], [ '9827', 'black club suit' ], [ '9829', 'black heart suit' ], [ '9830', 'black diamond suit' ], [ '8194', 'en space' ], [ '8195', 'em space' ], [ '8201', 'thin space' ], [ '8204', 'zero width non-joiner' ], [ '8205', 'zero width joiner' ], [ '8206', 'left-to-right mark' ], [ '8207', 'right-to-left mark' ] ]; }; var charmapFilter = function (charmap) { return global$1.grep(charmap, function (item) { return isArray(item) && item.length === 2; }); }; var getCharsFromSetting = function (settingValue) { if (isArray(settingValue)) { return [].concat(charmapFilter(settingValue)); } if (typeof settingValue === 'function') { return settingValue(); } return []; }; var extendCharMap = function (editor, charmap) { var userCharMap = Settings.getCharMap(editor); if (userCharMap) { charmap = getCharsFromSetting(userCharMap); } var userCharMapAppend = Settings.getCharMapAppend(editor); if (userCharMapAppend) { return [].concat(charmap).concat(getCharsFromSetting(userCharMapAppend)); } return charmap; }; var getCharMap$1 = function (editor) { return extendCharMap(editor, getDefaultCharMap()); }; var CharMap = { getCharMap: getCharMap$1 }; var get = function (editor) { var getCharMap = function () { return CharMap.getCharMap(editor); }; var insertChar = function (chr) { Actions.insertChar(editor, chr); }; return { getCharMap: getCharMap, insertChar: insertChar }; }; var Api = { get: get }; var getHtml = function (charmap) { var gridHtml, x, y; var width = Math.min(charmap.length, 25); var height = Math.ceil(charmap.length / width); gridHtml = ''; for (y = 0; y < height; y++) { gridHtml += ''; for (x = 0; x < width; x++) { var index = y * width + x; if (index < charmap.length) { var chr = charmap[index]; var charCode = parseInt(chr[0], 10); var chrText = chr ? String.fromCharCode(charCode) : ' '; gridHtml += ''; } else { gridHtml += ''; } gridHtml += ''; return gridHtml; }; var GridHtml = { getHtml: getHtml }; var getParentTd = function (elm) { while (elm) { if (elm.nodeName === 'TD') { return elm; } elm = elm.parentNode; } }; var open = function (editor) { var win; var charMapPanel = { type: 'container', html: GridHtml.getHtml(CharMap.getCharMap(editor)), onclick: function (e) { var target = e.target; if (/^(TD|DIV)$/.test(target.nodeName)) { var charDiv = getParentTd(target).firstChild; if (charDiv && charDiv.hasAttribute('data-chr')) { var charCodeString = charDiv.getAttribute('data-chr'); var charCode = parseInt(charCodeString, 10); if (!isNaN(charCode)) { Actions.insertChar(editor, String.fromCharCode(charCode)); } if (!e.ctrlKey) { win.close(); } } } }, onmouseover: function (e) { var td = getParentTd(e.target); if (td && td.firstChild) { win.find('#preview').text(td.firstChild.firstChild.data); win.find('#previewTitle').text(td.title); } else { win.find('#preview').text(' '); win.find('#previewTitle').text(' '); } } }; win = editor.windowManager.open({ title: 'Special character', spacing: 10, padding: 10, items: [ charMapPanel, { type: 'container', layout: 'flex', direction: 'column', align: 'center', spacing: 5, minWidth: 160, minHeight: 160, items: [ { type: 'label', name: 'preview', text: ' ', style: 'font-size: 40px; text-align: center', border: 1, minWidth: 140, minHeight: 80 }, { type: 'spacer', minHeight: 20 }, { type: 'label', name: 'previewTitle', text: ' ', style: 'white-space: pre-wrap;', border: 1, minWidth: 140 } ] } ], buttons: [{ text: 'Close', onclick: function () { win.close(); } }] }); }; var Dialog = { open: open }; var register = function (editor) { editor.addCommand('mceShowCharmap', function () { Dialog.open(editor); }); }; var Commands = { register: register }; var register$1 = function (editor) { editor.addButton('charmap', { icon: 'charmap', tooltip: 'Special character', cmd: 'mceShowCharmap' }); editor.addMenuItem('charmap', { icon: 'charmap', text: 'Special character', cmd: 'mceShowCharmap', context: 'insert' }); }; var Buttons = { register: register$1 }; global.add('charmap', function (editor) { Commands.register(editor); Buttons.register(editor); return Api.get(editor); }); function Plugin () { } return Plugin; }()); })(); charmap/plugin.min.js000064400000020631147331520370010604 0ustar00!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(e,t){return e.fire("insertCustomChar",{chr:t})},l=function(e,t){var a=i(e,t).chr;e.execCommand("mceInsertContent",!1,a)},a=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(e){return e.settings.charmap},n=function(e){return e.settings.charmap_append},o=a.isArray,c=function(e){return o(e)?[].concat((t=e,a.grep(t,function(e){return o(e)&&2===e.length}))):"function"==typeof e?e():[];var t},s=function(e){return function(e,t){var a=r(e);a&&(t=c(a));var i=n(e);return i?[].concat(t).concat(c(i)):t}(e,[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]])},t=function(t){return{getCharMap:function(){return s(t)},insertChar:function(e){l(t,e)}}},u=function(e){var t,a,i,r=Math.min(e.length,25),n=Math.ceil(e.length/r);for(t='',i=0;i",a=0;a
'+s+"
"}else t+="
"}return t+=""},d=function(e){for(;e;){if("TD"===e.nodeName)return e;e=e.parentNode}},m=function(n){var o,e={type:"container",html:u(s(n)),onclick:function(e){var t=e.target;if(/^(TD|DIV)$/.test(t.nodeName)){var a=d(t).firstChild;if(a&&a.hasAttribute("data-chr")){var i=a.getAttribute("data-chr"),r=parseInt(i,10);isNaN(r)||l(n,String.fromCharCode(r)),e.ctrlKey||o.close()}}},onmouseover:function(e){var t=d(e.target);t&&t.firstChild?(o.find("#preview").text(t.firstChild.firstChild.data),o.find("#previewTitle").text(t.title)):(o.find("#preview").text(" "),o.find("#previewTitle").text(" "))}};o=n.windowManager.open({title:"Special character",spacing:10,padding:10,items:[e,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){o.close()}}]})},g=function(e){e.addCommand("mceShowCharmap",function(){m(e)})},p=function(e){e.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};e.add("charmap",function(e){return g(e),p(e),t(e)})}();hr/plugin.js000064400000001627147331520370007024 0ustar00(function () { var hr = (function () { 'use strict'; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var register = function (editor) { editor.addCommand('InsertHorizontalRule', function () { editor.execCommand('mceInsertContent', false, '
'); }); }; var Commands = { register: register }; var register$1 = function (editor) { editor.addButton('hr', { icon: 'hr', tooltip: 'Horizontal line', cmd: 'InsertHorizontalRule' }); editor.addMenuItem('hr', { icon: 'hr', text: 'Horizontal line', cmd: 'InsertHorizontalRule', context: 'insert' }); }; var Buttons = { register: register$1 }; global.add('hr', function (editor) { Commands.register(editor); Buttons.register(editor); }); function Plugin () { } return Plugin; }()); })(); hr/plugin.min.js000064400000000654147331520370007605 0ustar00!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"
")})},o=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};n.add("hr",function(n){t(n),o(n)})}();colorpicker/plugin.js000064400000006751147331520370010732 0ustar00(function () { var colorpicker = (function () { 'use strict'; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var global$1 = tinymce.util.Tools.resolve('tinymce.util.Color'); var showPreview = function (win, hexColor) { win.find('#preview')[0].getEl().style.background = hexColor; }; var setColor = function (win, value) { var color = global$1(value), rgb = color.toRgb(); win.fromJSON({ r: rgb.r, g: rgb.g, b: rgb.b, hex: color.toHex().substr(1) }); showPreview(win, color.toHex()); }; var open = function (editor, callback, value) { var win = editor.windowManager.open({ title: 'Color', items: { type: 'container', layout: 'flex', direction: 'row', align: 'stretch', padding: 5, spacing: 10, items: [ { type: 'colorpicker', value: value, onchange: function () { var rgb = this.rgb(); if (win) { win.find('#r').value(rgb.r); win.find('#g').value(rgb.g); win.find('#b').value(rgb.b); win.find('#hex').value(this.value().substr(1)); showPreview(win, this.value()); } } }, { type: 'form', padding: 0, labelGap: 5, defaults: { type: 'textbox', size: 7, value: '0', flex: 1, spellcheck: false, onchange: function () { var colorPickerCtrl = win.find('colorpicker')[0]; var name, value; name = this.name(); value = this.value(); if (name === 'hex') { value = '#' + value; setColor(win, value); colorPickerCtrl.value(value); return; } value = { r: win.find('#r').value(), g: win.find('#g').value(), b: win.find('#b').value() }; colorPickerCtrl.value(value); setColor(win, value); } }, items: [ { name: 'r', label: 'R', autofocus: 1 }, { name: 'g', label: 'G' }, { name: 'b', label: 'B' }, { name: 'hex', label: '#', value: '000000' }, { name: 'preview', type: 'container', border: 1 } ] } ] }, onSubmit: function () { callback('#' + win.toJSON().hex); } }); setColor(win, value); }; var Dialog = { open: open }; global.add('colorpicker', function (editor) { if (!editor.settings.color_picker_callback) { editor.settings.color_picker_callback = function (callback, value) { Dialog.open(editor, callback, value); }; } }); function Plugin () { } return Plugin; }()); })(); colorpicker/plugin.min.js000064400000002505147331520370011505 0ustar00!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Color"),a=function(e,n){e.find("#preview")[0].getEl().style.background=n},o=function(e,n){var i=l(n),t=i.toRgb();e.fromJSON({r:t.r,g:t.g,b:t.b,hex:i.toHex().substr(1)}),a(e,i.toHex())},t=function(e,n,i){var t=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:i,onchange:function(){var e=this.rgb();t&&(t.find("#r").value(e.r),t.find("#g").value(e.g),t.find("#b").value(e.b),t.find("#hex").value(this.value().substr(1)),a(t,this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,n,i=t.find("colorpicker")[0];if(e=this.name(),n=this.value(),"hex"===e)return o(t,n="#"+n),void i.value(n);n={r:t.find("#r").value(),g:t.find("#g").value(),b:t.find("#b").value()},i.value(n),o(t,n)}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){n("#"+t.toJSON().hex)}});o(t,i)};e.add("colorpicker",function(i){i.settings.color_picker_callback||(i.settings.color_picker_callback=function(e,n){t(i,e,n)})})}();paste/plugin.js000064400000240664147331520370007535 0ustar00(function () { var paste = (function (domGlobals) { 'use strict'; var Cell = function (initial) { var value = initial; var get = function () { return value; }; var set = function (v) { value = v; }; var clone = function () { return Cell(get()); }; return { get: get, set: set, clone: clone }; }; var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); var hasProPlugin = function (editor) { if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global$1.get('powerpaste')) { if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) { domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.'); } return true; } else { return false; } }; var DetectProPlugin = { hasProPlugin: hasProPlugin }; var get = function (clipboard, quirks) { return { clipboard: clipboard, quirks: quirks }; }; var Api = { get: get }; var firePastePreProcess = function (editor, html, internal, isWordHtml) { return editor.fire('PastePreProcess', { content: html, internal: internal, wordContent: isWordHtml }); }; var firePastePostProcess = function (editor, node, internal, isWordHtml) { return editor.fire('PastePostProcess', { node: node, internal: internal, wordContent: isWordHtml }); }; var firePastePlainTextToggle = function (editor, state) { return editor.fire('PastePlainTextToggle', { state: state }); }; var firePaste = function (editor, ieFake) { return editor.fire('paste', { ieFake: ieFake }); }; var Events = { firePastePreProcess: firePastePreProcess, firePastePostProcess: firePastePostProcess, firePastePlainTextToggle: firePastePlainTextToggle, firePaste: firePaste }; var shouldPlainTextInform = function (editor) { return editor.getParam('paste_plaintext_inform', true); }; var shouldBlockDrop = function (editor) { return editor.getParam('paste_block_drop', false); }; var shouldPasteDataImages = function (editor) { return editor.getParam('paste_data_images', false); }; var shouldFilterDrop = function (editor) { return editor.getParam('paste_filter_drop', true); }; var getPreProcess = function (editor) { return editor.getParam('paste_preprocess'); }; var getPostProcess = function (editor) { return editor.getParam('paste_postprocess'); }; var getWebkitStyles = function (editor) { return editor.getParam('paste_webkit_styles'); }; var shouldRemoveWebKitStyles = function (editor) { return editor.getParam('paste_remove_styles_if_webkit', true); }; var shouldMergeFormats = function (editor) { return editor.getParam('paste_merge_formats', true); }; var isSmartPasteEnabled = function (editor) { return editor.getParam('smart_paste', true); }; var isPasteAsTextEnabled = function (editor) { return editor.getParam('paste_as_text', false); }; var getRetainStyleProps = function (editor) { return editor.getParam('paste_retain_style_properties'); }; var getWordValidElements = function (editor) { var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'; return editor.getParam('paste_word_valid_elements', defaultValidElements); }; var shouldConvertWordFakeLists = function (editor) { return editor.getParam('paste_convert_word_fake_lists', true); }; var shouldUseDefaultFilters = function (editor) { return editor.getParam('paste_enable_default_filters', true); }; var Settings = { shouldPlainTextInform: shouldPlainTextInform, shouldBlockDrop: shouldBlockDrop, shouldPasteDataImages: shouldPasteDataImages, shouldFilterDrop: shouldFilterDrop, getPreProcess: getPreProcess, getPostProcess: getPostProcess, getWebkitStyles: getWebkitStyles, shouldRemoveWebKitStyles: shouldRemoveWebKitStyles, shouldMergeFormats: shouldMergeFormats, isSmartPasteEnabled: isSmartPasteEnabled, isPasteAsTextEnabled: isPasteAsTextEnabled, getRetainStyleProps: getRetainStyleProps, getWordValidElements: getWordValidElements, shouldConvertWordFakeLists: shouldConvertWordFakeLists, shouldUseDefaultFilters: shouldUseDefaultFilters }; var shouldInformUserAboutPlainText = function (editor, userIsInformedState) { return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor); }; var displayNotification = function (editor, message) { editor.notificationManager.open({ text: editor.translate(message), type: 'info' }); }; var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) { if (clipboard.pasteFormat.get() === 'text') { clipboard.pasteFormat.set('html'); Events.firePastePlainTextToggle(editor, false); } else { clipboard.pasteFormat.set('text'); Events.firePastePlainTextToggle(editor, true); if (shouldInformUserAboutPlainText(editor, userIsInformedState)) { displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.'); userIsInformedState.set(true); } } editor.focus(); }; var Actions = { togglePlainTextPaste: togglePlainTextPaste }; var register = function (editor, clipboard, userIsInformedState) { editor.addCommand('mceTogglePlainTextPaste', function () { Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState); }); editor.addCommand('mceInsertClipboardContent', function (ui, value) { if (value.content) { clipboard.pasteHtml(value.content, value.internal); } if (value.text) { clipboard.pasteText(value.text); } }); }; var Commands = { register: register }; var global$2 = tinymce.util.Tools.resolve('tinymce.Env'); var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay'); var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK'); var internalMimeType = 'x-tinymce/html'; var internalMark = ''; var mark = function (html) { return internalMark + html; }; var unmark = function (html) { return html.replace(internalMark, ''); }; var isMarked = function (html) { return html.indexOf(internalMark) !== -1; }; var InternalHtml = { mark: mark, unmark: unmark, isMarked: isMarked, internalHtmlMime: function () { return internalMimeType; } }; var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities'); var isPlainText = function (text) { return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text); }; var toBRs = function (text) { return text.replace(/\r?\n/g, '
'); }; var openContainer = function (rootTag, rootAttrs) { var key; var attrs = []; var tag = '<' + rootTag; if (typeof rootAttrs === 'object') { for (key in rootAttrs) { if (rootAttrs.hasOwnProperty(key)) { attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"'); } } if (attrs.length) { tag += ' ' + attrs.join(' '); } } return tag + '>'; }; var toBlockElements = function (text, rootTag, rootAttrs) { var blocks = text.split(/\n\n/); var tagOpen = openContainer(rootTag, rootAttrs); var tagClose = ''; var paragraphs = global$4.map(blocks, function (p) { return p.split(/\n/).join('
'); }); var stitch = function (p) { return tagOpen + p + tagClose; }; return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join(''); }; var convert = function (text, rootTag, rootAttrs) { return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text); }; var Newlines = { isPlainText: isPlainText, convert: convert, toBRs: toBRs, toBlockElements: toBlockElements }; var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); var global$8 = tinymce.util.Tools.resolve('tinymce.html.Serializer'); var global$9 = tinymce.util.Tools.resolve('tinymce.html.Node'); var global$a = tinymce.util.Tools.resolve('tinymce.html.Schema'); function filter(content, items) { global$4.each(items, function (v) { if (v.constructor === RegExp) { content = content.replace(v, ''); } else { content = content.replace(v[0], v[1]); } }); return content; } function innerText(html) { var schema = global$a(); var domParser = global$7({}, schema); var text = ''; var shortEndedElements = schema.getShortEndedElements(); var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' '); var blockElements = schema.getBlockElements(); function walk(node) { var name = node.name, currentNode = node; if (name === 'br') { text += '\n'; return; } if (name === 'wbr') { return; } if (shortEndedElements[name]) { text += ' '; } if (ignoreElements[name]) { text += ' '; return; } if (node.type === 3) { text += node.value; } if (!node.shortEnded) { if (node = node.firstChild) { do { walk(node); } while (node = node.next); } } if (blockElements[name] && currentNode.next) { text += '\n'; if (name === 'p') { text += '\n'; } } } html = filter(html, [//g]); walk(domParser.parse(html)); return text; } function trimHtml(html) { function trimSpaces(all, s1, s2) { if (!s1 && !s2) { return ' '; } return '\xA0'; } html = filter(html, [ /^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig, /|/g, [ /( ?)\u00a0<\/span>( ?)/g, trimSpaces ], /
/g, /
$/i ]); return html; } function createIdGenerator(prefix) { var count = 0; return function () { return prefix + count++; }; } var isMsEdge = function () { return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1; }; var Utils = { filter: filter, innerText: innerText, trimHtml: trimHtml, createIdGenerator: createIdGenerator, isMsEdge: isMsEdge }; function isWordContent(content) { return / 1) { currentListNode.attr('start', '' + start); } paragraphNode.wrap(currentListNode); } else { currentListNode.append(paragraphNode); } paragraphNode.name = 'li'; if (level > lastLevel && prevListNode) { prevListNode.lastChild.append(currentListNode); } lastLevel = level; removeIgnoredNodes(paragraphNode); trimListStart(paragraphNode, /^\u00a0+/); trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/); trimListStart(paragraphNode, /^\u00a0+/); } var elements = []; var child = node.firstChild; while (typeof child !== 'undefined' && child !== null) { elements.push(child); child = child.walk(); if (child !== null) { while (typeof child !== 'undefined' && child.parent !== node) { child = child.walk(); } } } for (var i = 0; i < elements.length; i++) { node = elements[i]; if (node.name === 'p' && node.firstChild) { var nodeText = getText(node); if (isBulletList(nodeText)) { convertParagraphToLi(node, 'ul'); continue; } if (isNumericList(nodeText)) { var matches = /([0-9]+)\./.exec(nodeText); var start = 1; if (matches) { start = parseInt(matches[1], 10); } convertParagraphToLi(node, 'ol', start); continue; } if (node._listLevel) { convertParagraphToLi(node, 'ul', 1); continue; } currentListNode = null; } else { prevListNode = currentListNode; currentListNode = null; } } } function filterStyles(editor, validStyles, node, styleValue) { var outputStyles = {}, matches; var styles = editor.dom.parseStyle(styleValue); global$4.each(styles, function (value, name) { switch (name) { case 'mso-list': matches = /\w+ \w+([0-9]+)/i.exec(styleValue); if (matches) { node._listLevel = parseInt(matches[1], 10); } if (/Ignore/i.test(value) && node.firstChild) { node._listIgnore = true; node.firstChild._listIgnore = true; } break; case 'horiz-align': name = 'text-align'; break; case 'vert-align': name = 'vertical-align'; break; case 'font-color': case 'mso-foreground': name = 'color'; break; case 'mso-background': case 'mso-highlight': name = 'background'; break; case 'font-weight': case 'font-style': if (value !== 'normal') { outputStyles[name] = value; } return; case 'mso-element': if (/^(comment|comment-list)$/i.test(value)) { node.remove(); return; } break; } if (name.indexOf('mso-comment') === 0) { node.remove(); return; } if (name.indexOf('mso-') === 0) { return; } if (Settings.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) { outputStyles[name] = value; } }); if (/(bold)/i.test(outputStyles['font-weight'])) { delete outputStyles['font-weight']; node.wrap(new global$9('b', 1)); } if (/(italic)/i.test(outputStyles['font-style'])) { delete outputStyles['font-style']; node.wrap(new global$9('i', 1)); } outputStyles = editor.dom.serializeStyle(outputStyles, node.name); if (outputStyles) { return outputStyles; } return null; } var filterWordContent = function (editor, content) { var retainStyleProperties, validStyles; retainStyleProperties = Settings.getRetainStyleProps(editor); if (retainStyleProperties) { validStyles = global$4.makeMap(retainStyleProperties.split(/[, ]/)); } content = Utils.filter(content, [ /
/gi, /]+id="?docs-internal-[^>]*>/gi, //gi, /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, [ /<(\/?)s>/gi, '<$1strike>' ], [ / /gi, '\xA0' ], [ /([\s\u00a0]*)<\/span>/gi, function (str, spaces) { return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : ''; } ] ]); var validElements = Settings.getWordValidElements(editor); var schema = global$a({ valid_elements: validElements, valid_children: '-li[p]' }); global$4.each(schema.elements, function (rule) { if (!rule.attributes.class) { rule.attributes.class = {}; rule.attributesOrder.push('class'); } if (!rule.attributes.style) { rule.attributes.style = {}; rule.attributesOrder.push('style'); } }); var domParser = global$7({}, schema); domParser.addAttributeFilter('style', function (nodes) { var i = nodes.length, node; while (i--) { node = nodes[i]; node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); if (node.name === 'span' && node.parent && !node.attributes.length) { node.unwrap(); } } }); domParser.addAttributeFilter('class', function (nodes) { var i = nodes.length, node, className; while (i--) { node = nodes[i]; className = node.attr('class'); if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) { node.remove(); } node.attr('class', null); } }); domParser.addNodeFilter('del', function (nodes) { var i = nodes.length; while (i--) { nodes[i].remove(); } }); domParser.addNodeFilter('a', function (nodes) { var i = nodes.length, node, href, name; while (i--) { node = nodes[i]; href = node.attr('href'); name = node.attr('name'); if (href && href.indexOf('#_msocom_') !== -1) { node.remove(); continue; } if (href && href.indexOf('file://') === 0) { href = href.split('#')[1]; if (href) { href = '#' + href; } } if (!href && !name) { node.unwrap(); } else { if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) { node.unwrap(); continue; } node.attr({ href: href, name: name }); } } }); var rootNode = domParser.parse(content); if (Settings.shouldConvertWordFakeLists(editor)) { convertFakeListsToProperLists(rootNode); } content = global$8({ validate: editor.settings.validate }, schema).serialize(rootNode); return content; }; var preProcess = function (editor, content) { return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; }; var WordFilter = { preProcess: preProcess, isWordContent: isWordContent }; var preProcess$1 = function (editor, html) { var parser = global$7({}, editor.schema); parser.addNodeFilter('meta', function (nodes) { global$4.each(nodes, function (node) { return node.remove(); }); }); var fragment = parser.parse(html, { forced_root_block: false, isRootContent: true }); return global$8({ validate: editor.settings.validate }, editor.schema).serialize(fragment); }; var processResult = function (content, cancelled) { return { content: content, cancelled: cancelled }; }; var postProcessFilter = function (editor, html, internal, isWordHtml) { var tempBody = editor.dom.create('div', { style: 'display:none' }, html); var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml); return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); }; var filterContent = function (editor, content, internal, isWordHtml) { var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml); var filteredContent = preProcess$1(editor, preProcessArgs.content); if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { return postProcessFilter(editor, filteredContent, internal, isWordHtml); } else { return processResult(filteredContent, preProcessArgs.isDefaultPrevented()); } }; var process = function (editor, html, internal) { var isWordHtml = WordFilter.isWordContent(html); var content = isWordHtml ? WordFilter.preProcess(editor, html) : html; return filterContent(editor, content, internal, isWordHtml); }; var ProcessFilters = { process: process }; var pasteHtml = function (editor, html) { editor.insertContent(html, { merge: Settings.shouldMergeFormats(editor), paste: true }); return true; }; var isAbsoluteUrl = function (url) { return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url); }; var isImageUrl = function (url) { return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url); }; var createImage = function (editor, url, pasteHtmlFn) { editor.undoManager.extra(function () { pasteHtmlFn(editor, url); }, function () { editor.insertContent(''); }); return true; }; var createLink = function (editor, url, pasteHtmlFn) { editor.undoManager.extra(function () { pasteHtmlFn(editor, url); }, function () { editor.execCommand('mceInsertLink', false, url); }); return true; }; var linkSelection = function (editor, html, pasteHtmlFn) { return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false; }; var insertImage = function (editor, html, pasteHtmlFn) { return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false; }; var smartInsertContent = function (editor, html) { global$4.each([ linkSelection, insertImage, pasteHtml ], function (action) { return action(editor, html, pasteHtml) !== true; }); }; var insertContent = function (editor, html) { if (Settings.isSmartPasteEnabled(editor) === false) { pasteHtml(editor, html); } else { smartInsertContent(editor, html); } }; var SmartPaste = { isImageUrl: isImageUrl, isAbsoluteUrl: isAbsoluteUrl, insertContent: insertContent }; var noop = function () { }; var constant = function (value) { return function () { return value; }; }; function curry(fn) { var initialArgs = []; for (var _i = 1; _i < arguments.length; _i++) { initialArgs[_i - 1] = arguments[_i]; } return function () { var restArgs = []; for (var _i = 0; _i < arguments.length; _i++) { restArgs[_i] = arguments[_i]; } var all = initialArgs.concat(restArgs); return fn.apply(null, all); }; } var never = constant(false); var always = constant(true); var none = function () { return NONE; }; var NONE = function () { var eq = function (o) { return o.isNone(); }; var call = function (thunk) { return thunk(); }; var id = function (n) { return n; }; var me = { fold: function (n, s) { return n(); }, is: never, isSome: never, isNone: always, getOr: id, getOrThunk: call, getOrDie: function (msg) { throw new Error(msg || 'error: getOrDie called on none.'); }, getOrNull: constant(null), getOrUndefined: constant(undefined), or: id, orThunk: call, map: none, each: noop, bind: none, exists: never, forall: always, filter: none, equals: eq, equals_: eq, toArray: function () { return []; }, toString: constant('none()') }; if (Object.freeze) { Object.freeze(me); } return me; }(); var some = function (a) { var constant_a = constant(a); var self = function () { return me; }; var bind = function (f) { return f(a); }; var me = { fold: function (n, s) { return s(a); }, is: function (v) { return a === v; }, isSome: always, isNone: never, getOr: constant_a, getOrThunk: constant_a, getOrDie: constant_a, getOrNull: constant_a, getOrUndefined: constant_a, or: self, orThunk: self, map: function (f) { return some(f(a)); }, each: function (f) { f(a); }, bind: bind, exists: bind, forall: bind, filter: function (f) { return f(a) ? me : NONE; }, toArray: function () { return [a]; }, toString: function () { return 'some(' + a + ')'; }, equals: function (o) { return o.is(a); }, equals_: function (o, elementEq) { return o.fold(never, function (b) { return elementEq(a, b); }); } }; return me; }; var from = function (value) { return value === null || value === undefined ? NONE : some(value); }; var Option = { some: some, none: none, from: from }; var typeOf = function (x) { if (x === null) { return 'null'; } var t = typeof x; if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { return 'array'; } if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { return 'string'; } return t; }; var isType = function (type) { return function (value) { return typeOf(value) === type; }; }; var isFunction = isType('function'); var nativeSlice = Array.prototype.slice; var map = function (xs, f) { var len = xs.length; var r = new Array(len); for (var i = 0; i < len; i++) { var x = xs[i]; r[i] = f(x, i); } return r; }; var each = function (xs, f) { for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; f(x, i); } }; var filter$1 = function (xs, pred) { var r = []; for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; if (pred(x, i)) { r.push(x); } } return r; }; var from$1 = isFunction(Array.from) ? Array.from : function (x) { return nativeSlice.call(x); }; var exports$1 = {}, module = { exports: exports$1 }; (function (define, exports, module, require) { (function (f) { if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = f(); } else if (typeof define === 'function' && define.amd) { define([], f); } else { var g; if (typeof window !== 'undefined') { g = window; } else if (typeof global !== 'undefined') { g = global; } else if (typeof self !== 'undefined') { g = self; } else { g = this; } g.EphoxContactWrapper = f(); } }(function () { return function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = 'function' == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error('Cannot find module \'' + i + '\''); throw a.code = 'MODULE_NOT_FOUND', a; } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r); }, p, p.exports, r, e, n, t); } return n[i].exports; } for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) o(t[i]); return o; } return r; }()({ 1: [ function (require, module, exports) { var process = module.exports = {}; var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout() { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } }()); function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { return setTimeout(fun, 0); } if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { return cachedSetTimeout(fun, 0); } catch (e) { try { return cachedSetTimeout.call(null, fun, 0); } catch (e) { return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { return clearTimeout(marker); } if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { return cachedClearTimeout(marker); } catch (e) { try { return cachedClearTimeout.call(null, marker); } catch (e) { return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while (len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; process.versions = {}; function noop() { } process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return []; }; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/'; }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function () { return 0; }; }, {} ], 2: [ function (require, module, exports) { (function (setImmediate) { (function (root) { var setTimeoutFunc = setTimeout; function noop() { } function bind(fn, thisArg) { return function () { fn.apply(thisArg, arguments); }; } function Promise(fn) { if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new'); if (typeof fn !== 'function') throw new TypeError('not a function'); this._state = 0; this._handled = false; this._value = undefined; this._deferreds = []; doResolve(fn, this); } function handle(self, deferred) { while (self._state === 3) { self = self._value; } if (self._state === 0) { self._deferreds.push(deferred); return; } self._handled = true; Promise._immediateFn(function () { var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self._state === 1 ? resolve : reject)(deferred.promise, self._value); return; } var ret; try { ret = cb(self._value); } catch (e) { reject(deferred.promise, e); return; } resolve(deferred.promise, ret); }); } function resolve(self, newValue) { try { if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.'); if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { var then = newValue.then; if (newValue instanceof Promise) { self._state = 3; self._value = newValue; finale(self); return; } else if (typeof then === 'function') { doResolve(bind(then, newValue), self); return; } } self._state = 1; self._value = newValue; finale(self); } catch (e) { reject(self, e); } } function reject(self, newValue) { self._state = 2; self._value = newValue; finale(self); } function finale(self) { if (self._state === 2 && self._deferreds.length === 0) { Promise._immediateFn(function () { if (!self._handled) { Promise._unhandledRejectionFn(self._value); } }); } for (var i = 0, len = self._deferreds.length; i < len; i++) { handle(self, self._deferreds[i]); } self._deferreds = null; } function Handler(onFulfilled, onRejected, promise) { this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; this.onRejected = typeof onRejected === 'function' ? onRejected : null; this.promise = promise; } function doResolve(fn, self) { var done = false; try { fn(function (value) { if (done) return; done = true; resolve(self, value); }, function (reason) { if (done) return; done = true; reject(self, reason); }); } catch (ex) { if (done) return; done = true; reject(self, ex); } } Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; Promise.prototype.then = function (onFulfilled, onRejected) { var prom = new this.constructor(noop); handle(this, new Handler(onFulfilled, onRejected, prom)); return prom; }; Promise.all = function (arr) { var args = Array.prototype.slice.call(arr); return new Promise(function (resolve, reject) { if (args.length === 0) return resolve([]); var remaining = args.length; function res(i, val) { try { if (val && (typeof val === 'object' || typeof val === 'function')) { var then = val.then; if (typeof then === 'function') { then.call(val, function (val) { res(i, val); }, reject); return; } } args[i] = val; if (--remaining === 0) { resolve(args); } } catch (ex) { reject(ex); } } for (var i = 0; i < args.length; i++) { res(i, args[i]); } }); }; Promise.resolve = function (value) { if (value && typeof value === 'object' && value.constructor === Promise) { return value; } return new Promise(function (resolve) { resolve(value); }); }; Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); }); }; Promise.race = function (values) { return new Promise(function (resolve, reject) { for (var i = 0, len = values.length; i < len; i++) { values[i].then(resolve, reject); } }); }; Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { setImmediate(fn); } : function (fn) { setTimeoutFunc(fn, 0); }; Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { if (typeof console !== 'undefined' && console) { console.warn('Possible Unhandled Promise Rejection:', err); } }; Promise._setImmediateFn = function _setImmediateFn(fn) { Promise._immediateFn = fn; }; Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { Promise._unhandledRejectionFn = fn; }; if (typeof module !== 'undefined' && module.exports) { module.exports = Promise; } else if (!root.Promise) { root.Promise = Promise; } }(this)); }.call(this, require('timers').setImmediate)); }, { 'timers': 3 } ], 3: [ function (require, module, exports) { (function (setImmediate, clearImmediate) { var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; var slice = Array.prototype.slice; var immediateIds = {}; var nextImmediateId = 0; exports.setTimeout = function () { return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); }; exports.setInterval = function () { return new Timeout(apply.call(setInterval, window, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function (timeout) { timeout.close(); }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function () { }; Timeout.prototype.close = function () { this._clearFn.call(window, this._id); }; exports.enroll = function (item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function (item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function (item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { var id = nextImmediateId++; var args = arguments.length < 2 ? false : slice.call(arguments, 1); immediateIds[id] = true; nextTick(function onNextTick() { if (immediateIds[id]) { if (args) { fn.apply(null, args); } else { fn.call(null); } exports.clearImmediate(id); } }); return id; }; exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { delete immediateIds[id]; }; }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); }, { 'process/browser.js': 1, 'timers': 3 } ], 4: [ function (require, module, exports) { var promisePolyfill = require('promise-polyfill'); var Global = function () { if (typeof window !== 'undefined') { return window; } else { return Function('return this;')(); } }(); module.exports = { boltExport: Global.Promise || promisePolyfill }; }, { 'promise-polyfill': 2 } ] }, {}, [4])(4); })); }(undefined, exports$1, module, undefined)); var Promise = module.exports.boltExport; var nu = function (baseFn) { var data = Option.none(); var callbacks = []; var map = function (f) { return nu(function (nCallback) { get(function (data) { nCallback(f(data)); }); }); }; var get = function (nCallback) { if (isReady()) { call(nCallback); } else { callbacks.push(nCallback); } }; var set = function (x) { data = Option.some(x); run(callbacks); callbacks = []; }; var isReady = function () { return data.isSome(); }; var run = function (cbs) { each(cbs, call); }; var call = function (cb) { data.each(function (x) { domGlobals.setTimeout(function () { cb(x); }, 0); }); }; baseFn(set); return { get: get, map: map, isReady: isReady }; }; var pure = function (a) { return nu(function (callback) { callback(a); }); }; var LazyValue = { nu: nu, pure: pure }; var errorReporter = function (err) { domGlobals.setTimeout(function () { throw err; }, 0); }; var make = function (run) { var get = function (callback) { run().then(callback, errorReporter); }; var map = function (fab) { return make(function () { return run().then(fab); }); }; var bind = function (aFutureB) { return make(function () { return run().then(function (v) { return aFutureB(v).toPromise(); }); }); }; var anonBind = function (futureB) { return make(function () { return run().then(function () { return futureB.toPromise(); }); }); }; var toLazy = function () { return LazyValue.nu(get); }; var toCached = function () { var cache = null; return make(function () { if (cache === null) { cache = run(); } return cache; }); }; var toPromise = run; return { map: map, bind: bind, anonBind: anonBind, toLazy: toLazy, toCached: toCached, toPromise: toPromise, get: get }; }; var nu$1 = function (baseFn) { return make(function () { return new Promise(baseFn); }); }; var pure$1 = function (a) { return make(function () { return Promise.resolve(a); }); }; var Future = { nu: nu$1, pure: pure$1 }; var par = function (asyncValues, nu) { return nu(function (callback) { var r = []; var count = 0; var cb = function (i) { return function (value) { r[i] = value; count++; if (count >= asyncValues.length) { callback(r); } }; }; if (asyncValues.length === 0) { callback([]); } else { each(asyncValues, function (asyncValue, i) { asyncValue.get(cb(i)); }); } }); }; var par$1 = function (futures) { return par(futures, Future.nu); }; var traverse = function (array, fn) { return par$1(map(array, fn)); }; var mapM = traverse; var value = function () { var subject = Cell(Option.none()); var clear = function () { subject.set(Option.none()); }; var set = function (s) { subject.set(Option.some(s)); }; var on = function (f) { subject.get().each(f); }; var isSet = function () { return subject.get().isSome(); }; return { clear: clear, set: set, isSet: isSet, on: on }; }; var pasteHtml$1 = function (editor, html, internalFlag) { var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html); var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal); if (args.cancelled === false) { SmartPaste.insertContent(editor, args.content); } }; var pasteText = function (editor, text) { text = editor.dom.encode(text).replace(/\r\n/g, '\n'); text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs); pasteHtml$1(editor, text, false); }; var getDataTransferItems = function (dataTransfer) { var items = {}; var mceInternalUrlPrefix = 'data:text/mce-internal,'; if (dataTransfer) { if (dataTransfer.getData) { var legacyText = dataTransfer.getData('Text'); if (legacyText && legacyText.length > 0) { if (legacyText.indexOf(mceInternalUrlPrefix) === -1) { items['text/plain'] = legacyText; } } } if (dataTransfer.types) { for (var i = 0; i < dataTransfer.types.length; i++) { var contentType = dataTransfer.types[i]; try { items[contentType] = dataTransfer.getData(contentType); } catch (ex) { items[contentType] = ''; } } } } return items; }; var getClipboardContent = function (editor, clipboardEvent) { var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer); return Utils.isMsEdge() ? global$4.extend(content, { 'text/html': '' }) : content; }; var hasContentType = function (clipboardContent, mimeType) { return mimeType in clipboardContent && clipboardContent[mimeType].length > 0; }; var hasHtmlOrText = function (content) { return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain'); }; var getBase64FromUri = function (uri) { var idx; idx = uri.indexOf(','); if (idx !== -1) { return uri.substr(idx + 1); } return null; }; var isValidDataUriImage = function (settings, imgElm) { return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true; }; var extractFilename = function (editor, str) { var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i); return m ? editor.dom.encode(m[1]) : null; }; var uniqueId = Utils.createIdGenerator('mceclip'); var pasteImage = function (editor, imageItem) { var base64 = getBase64FromUri(imageItem.uri); var id = uniqueId(); var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id; var img = new domGlobals.Image(); img.src = imageItem.uri; if (isValidDataUriImage(editor.settings, img)) { var blobCache = editor.editorUpload.blobCache; var blobInfo = void 0, existingBlobInfo = void 0; existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) { return cachedBlobInfo.base64() === base64; }); if (!existingBlobInfo) { blobInfo = blobCache.create(id, imageItem.blob, base64, name); blobCache.add(blobInfo); } else { blobInfo = existingBlobInfo; } pasteHtml$1(editor, '', false); } else { pasteHtml$1(editor, '', false); } }; var isClipboardEvent = function (event) { return event.type === 'paste'; }; var readBlobsAsDataUris = function (items) { return mapM(items, function (item) { return Future.nu(function (resolve) { var blob = item.getAsFile ? item.getAsFile() : item; var reader = new window.FileReader(); reader.onload = function () { resolve({ blob: blob, uri: reader.result }); }; reader.readAsDataURL(blob); }); }); }; var getImagesFromDataTransfer = function (dataTransfer) { var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) { return item.getAsFile(); }) : []; var files = dataTransfer.files ? from$1(dataTransfer.files) : []; var images = filter$1(items.length > 0 ? items : files, function (file) { return /^image\/(jpeg|png|gif|bmp)$/.test(file.type); }); return images; }; var pasteImageData = function (editor, e, rng) { var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer; if (editor.settings.paste_data_images && dataTransfer) { var images = getImagesFromDataTransfer(dataTransfer); if (images.length > 0) { e.preventDefault(); readBlobsAsDataUris(images).get(function (blobResults) { if (rng) { editor.selection.setRng(rng); } each(blobResults, function (result) { pasteImage(editor, result); }); }); return true; } } return false; }; var isBrokenAndroidClipboardEvent = function (e) { var clipboardData = e.clipboardData; return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0; }; var isKeyboardPasteEvent = function (e) { return global$5.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45; }; var registerEventHandlers = function (editor, pasteBin, pasteFormat) { var keyboardPasteEvent = value(); var keyboardPastePlainTextState; editor.on('keydown', function (e) { function removePasteBinOnKeyUp(e) { if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { pasteBin.remove(); } } if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) { keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86; if (keyboardPastePlainTextState && global$2.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) { return; } e.stopImmediatePropagation(); keyboardPasteEvent.set(e); window.setTimeout(function () { keyboardPasteEvent.clear(); }, 100); if (global$2.ie && keyboardPastePlainTextState) { e.preventDefault(); Events.firePaste(editor, true); return; } pasteBin.remove(); pasteBin.create(); editor.once('keyup', removePasteBinOnKeyUp); editor.once('paste', function () { editor.off('keyup', removePasteBinOnKeyUp); }); } }); function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) { var content, isPlainTextHtml; if (hasContentType(clipboardContent, 'text/html')) { content = clipboardContent['text/html']; } else { content = pasteBin.getHtml(); internal = internal ? internal : InternalHtml.isMarked(content); if (pasteBin.isDefaultContent(content)) { plainTextMode = true; } } content = Utils.trimHtml(content); pasteBin.remove(); isPlainTextHtml = internal === false && Newlines.isPlainText(content); if (!content.length || isPlainTextHtml) { plainTextMode = true; } if (plainTextMode) { if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) { content = clipboardContent['text/plain']; } else { content = Utils.innerText(content); } } if (pasteBin.isDefaultContent(content)) { if (!isKeyBoardPaste) { editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.'); } return; } if (plainTextMode) { pasteText(editor, content); } else { pasteHtml$1(editor, content, internal); } } var getLastRng = function () { return pasteBin.getLastRng() || editor.selection.getRng(); }; editor.on('paste', function (e) { var isKeyBoardPaste = keyboardPasteEvent.isSet(); var clipboardContent = getClipboardContent(editor, e); var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState; var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime()); keyboardPastePlainTextState = false; if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) { pasteBin.remove(); return; } if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) { pasteBin.remove(); return; } if (!isKeyBoardPaste) { e.preventDefault(); } if (global$2.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) { pasteBin.create(); editor.dom.bind(pasteBin.getEl(), 'paste', function (e) { e.stopPropagation(); }); editor.getDoc().execCommand('Paste', false, null); clipboardContent['text/html'] = pasteBin.getHtml(); } if (hasContentType(clipboardContent, 'text/html')) { e.preventDefault(); if (!internal) { internal = InternalHtml.isMarked(clipboardContent['text/html']); } insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); } else { global$3.setEditorTimeout(editor, function () { insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal); }, 0); } }); }; var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) { registerEventHandlers(editor, pasteBin, pasteFormat); var src; editor.parser.addNodeFilter('img', function (nodes, name, args) { var isPasteInsert = function (args) { return args.data && args.data.paste === true; }; var remove = function (node) { if (!node.attr('data-mce-object') && src !== global$2.transparentSrc) { node.remove(); } }; var isWebKitFakeUrl = function (src) { return src.indexOf('webkit-fake-url') === 0; }; var isDataUri = function (src) { return src.indexOf('data:') === 0; }; if (!editor.settings.paste_data_images && isPasteInsert(args)) { var i = nodes.length; while (i--) { src = nodes[i].attributes.map.src; if (!src) { continue; } if (isWebKitFakeUrl(src)) { remove(nodes[i]); } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) { remove(nodes[i]); } } } }); }; var getPasteBinParent = function (editor) { return global$2.ie && editor.inline ? domGlobals.document.body : editor.getBody(); }; var isExternalPasteBin = function (editor) { return getPasteBinParent(editor) !== editor.getBody(); }; var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) { if (isExternalPasteBin(editor)) { editor.dom.bind(pasteBinElm, 'paste keyup', function (e) { if (!isDefault(editor, pasteBinDefaultContent)) { editor.fire('paste'); } }); } }; var create = function (editor, lastRngCell, pasteBinDefaultContent) { var dom = editor.dom, body = editor.getBody(); var pasteBinElm; lastRngCell.set(editor.selection.getRng()); pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', { 'id': 'mcepastebin', 'class': 'mce-pastebin', 'contentEditable': true, 'data-mce-bogus': 'all', 'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0' }, pasteBinDefaultContent); if (global$2.ie || global$2.gecko) { dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535); } dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) { e.stopPropagation(); }); delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent); pasteBinElm.focus(); editor.selection.select(pasteBinElm, true); }; var remove = function (editor, lastRngCell) { if (getEl(editor)) { var pasteBinClone = void 0; var lastRng = lastRngCell.get(); while (pasteBinClone = editor.dom.get('mcepastebin')) { editor.dom.remove(pasteBinClone); editor.dom.unbind(pasteBinClone); } if (lastRng) { editor.selection.setRng(lastRng); } } lastRngCell.set(null); }; var getEl = function (editor) { return editor.dom.get('mcepastebin'); }; var getHtml = function (editor) { var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper; var copyAndRemove = function (toElm, fromElm) { toElm.appendChild(fromElm); editor.dom.remove(fromElm, true); }; pasteBinClones = global$4.grep(getPasteBinParent(editor).childNodes, function (elm) { return elm.id === 'mcepastebin'; }); pasteBinElm = pasteBinClones.shift(); global$4.each(pasteBinClones, function (pasteBinClone) { copyAndRemove(pasteBinElm, pasteBinClone); }); dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm); for (i = dirtyWrappers.length - 1; i >= 0; i--) { cleanWrapper = editor.dom.create('div'); pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]); copyAndRemove(cleanWrapper, dirtyWrappers[i]); } return pasteBinElm ? pasteBinElm.innerHTML : ''; }; var getLastRng = function (lastRng) { return lastRng.get(); }; var isDefaultContent = function (pasteBinDefaultContent, content) { return content === pasteBinDefaultContent; }; var isPasteBin = function (elm) { return elm && elm.id === 'mcepastebin'; }; var isDefault = function (editor, pasteBinDefaultContent) { var pasteBinElm = getEl(editor); return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML); }; var PasteBin = function (editor) { var lastRng = Cell(null); var pasteBinDefaultContent = '%MCEPASTEBIN%'; return { create: function () { return create(editor, lastRng, pasteBinDefaultContent); }, remove: function () { return remove(editor, lastRng); }, getEl: function () { return getEl(editor); }, getHtml: function () { return getHtml(editor); }, getLastRng: function () { return getLastRng(lastRng); }, isDefault: function () { return isDefault(editor, pasteBinDefaultContent); }, isDefaultContent: function (content) { return isDefaultContent(pasteBinDefaultContent, content); } }; }; var Clipboard = function (editor, pasteFormat) { var pasteBin = PasteBin(editor); editor.on('preInit', function () { return registerEventsAndFilters(editor, pasteBin, pasteFormat); }); return { pasteFormat: pasteFormat, pasteHtml: function (html, internalFlag) { return pasteHtml$1(editor, html, internalFlag); }, pasteText: function (text) { return pasteText(editor, text); }, pasteImageData: function (e, rng) { return pasteImageData(editor, e, rng); }, getDataTransferItems: getDataTransferItems, hasHtmlOrText: hasHtmlOrText, hasContentType: hasContentType }; }; var noop$1 = function () { }; var hasWorkingClipboardApi = function (clipboardData) { return global$2.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true; }; var setHtml5Clipboard = function (clipboardData, html, text) { if (hasWorkingClipboardApi(clipboardData)) { try { clipboardData.clearData(); clipboardData.setData('text/html', html); clipboardData.setData('text/plain', text); clipboardData.setData(InternalHtml.internalHtmlMime(), html); return true; } catch (e) { return false; } } else { return false; } }; var setClipboardData = function (evt, data, fallback, done) { if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) { evt.preventDefault(); done(); } else { fallback(data.html, done); } }; var fallback = function (editor) { return function (html, done) { var markedHtml = InternalHtml.mark(html); var outer = editor.dom.create('div', { 'contenteditable': 'false', 'data-mce-bogus': 'all' }); var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml); editor.dom.setStyles(outer, { position: 'fixed', top: '0', left: '-3000px', width: '1000px', overflow: 'hidden' }); outer.appendChild(inner); editor.dom.add(editor.getBody(), outer); var range = editor.selection.getRng(); inner.focus(); var offscreenRange = editor.dom.createRng(); offscreenRange.selectNodeContents(inner); editor.selection.setRng(offscreenRange); setTimeout(function () { editor.selection.setRng(range); outer.parentNode.removeChild(outer); done(); }, 0); }; }; var getData = function (editor) { return { html: editor.selection.getContent({ contextual: true }), text: editor.selection.getContent({ format: 'text' }) }; }; var isTableSelection = function (editor) { return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody()); }; var hasSelectedContent = function (editor) { return !editor.selection.isCollapsed() || isTableSelection(editor); }; var cut = function (editor) { return function (evt) { if (hasSelectedContent(editor)) { setClipboardData(evt, getData(editor), fallback(editor), function () { setTimeout(function () { editor.execCommand('Delete'); }, 0); }); } }; }; var copy = function (editor) { return function (evt) { if (hasSelectedContent(editor)) { setClipboardData(evt, getData(editor), fallback(editor), noop$1); } }; }; var register$1 = function (editor) { editor.on('cut', cut(editor)); editor.on('copy', copy(editor)); }; var CutCopy = { register: register$1 }; var global$b = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils'); var getCaretRangeFromEvent = function (editor, e) { return global$b.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()); }; var isPlainTextFileUrl = function (content) { var plainTextContent = content['text/plain']; return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false; }; var setFocusedRange = function (editor, rng) { editor.focus(); editor.selection.setRng(rng); }; var setup = function (editor, clipboard, draggingInternallyState) { if (Settings.shouldBlockDrop(editor)) { editor.on('dragend dragover draggesture dragdrop drop drag', function (e) { e.preventDefault(); e.stopPropagation(); }); } if (!Settings.shouldPasteDataImages(editor)) { editor.on('drop', function (e) { var dataTransfer = e.dataTransfer; if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) { e.preventDefault(); } }); } editor.on('drop', function (e) { var dropContent, rng; rng = getCaretRangeFromEvent(editor, e); if (e.isDefaultPrevented() || draggingInternallyState.get()) { return; } dropContent = clipboard.getDataTransferItems(e.dataTransfer); var internal = clipboard.hasContentType(dropContent, InternalHtml.internalHtmlMime()); if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) { return; } if (rng && Settings.shouldFilterDrop(editor)) { var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain']; if (content_1) { e.preventDefault(); global$3.setEditorTimeout(editor, function () { editor.undoManager.transact(function () { if (dropContent['mce-internal']) { editor.execCommand('Delete'); } setFocusedRange(editor, rng); content_1 = Utils.trimHtml(content_1); if (!dropContent['text/html']) { clipboard.pasteText(content_1); } else { clipboard.pasteHtml(content_1, internal); } }); }); } } }); editor.on('dragstart', function (e) { draggingInternallyState.set(true); }); editor.on('dragover dragend', function (e) { if (Settings.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) { e.preventDefault(); setFocusedRange(editor, getCaretRangeFromEvent(editor, e)); } if (e.type === 'dragend') { draggingInternallyState.set(false); } }); }; var DragDrop = { setup: setup }; var setup$1 = function (editor) { var plugin = editor.plugins.paste; var preProcess = Settings.getPreProcess(editor); if (preProcess) { editor.on('PastePreProcess', function (e) { preProcess.call(plugin, plugin, e); }); } var postProcess = Settings.getPostProcess(editor); if (postProcess) { editor.on('PastePostProcess', function (e) { postProcess.call(plugin, plugin, e); }); } }; var PrePostProcess = { setup: setup$1 }; function addPreProcessFilter(editor, filterFunc) { editor.on('PastePreProcess', function (e) { e.content = filterFunc(editor, e.content, e.internal, e.wordContent); }); } function addPostProcessFilter(editor, filterFunc) { editor.on('PastePostProcess', function (e) { filterFunc(editor, e.node); }); } function removeExplorerBrElementsAfterBlocks(editor, html) { if (!WordFilter.isWordContent(html)) { return html; } var blockElements = []; global$4.each(editor.schema.getBlockElements(), function (block, blockName) { blockElements.push(blockName); }); var explorerBlocksRegExp = new RegExp('(?:
 [\\s\\r\\n]+|
)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:
 [\\s\\r\\n]+|
)*', 'g'); html = Utils.filter(html, [[ explorerBlocksRegExp, '$1' ]]); html = Utils.filter(html, [ [ /

/g, '

' ], [ /
/g, ' ' ], [ /

/g, '
' ] ]); return html; } function removeWebKitStyles(editor, content, internal, isWordHtml) { if (isWordHtml || internal) { return content; } var webKitStylesSetting = Settings.getWebkitStyles(editor); var webKitStyles; if (Settings.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') { return content; } if (webKitStylesSetting) { webKitStyles = webKitStylesSetting.split(/[, ]/); } if (webKitStyles) { var dom_1 = editor.dom, node_1 = editor.selection.getNode(); content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) { var inputStyles = dom_1.parseStyle(dom_1.decode(value)); var outputStyles = {}; if (webKitStyles === 'none') { return before + after; } for (var i = 0; i < webKitStyles.length; i++) { var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true); if (/color/.test(webKitStyles[i])) { inputValue = dom_1.toHex(inputValue); currentValue = dom_1.toHex(currentValue); } if (currentValue !== inputValue) { outputStyles[webKitStyles[i]] = inputValue; } } outputStyles = dom_1.serializeStyle(outputStyles, 'span'); if (outputStyles) { return before + ' style="' + outputStyles + '"' + after; } return before + after; }); } else { content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3'); } content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) { return before + ' style="' + value + '"' + after; }); return content; } function removeUnderlineAndFontInAnchor(editor, root) { editor.$('a', root).find('font,u').each(function (i, node) { editor.dom.remove(node, true); }); } var setup$2 = function (editor) { if (global$2.webkit) { addPreProcessFilter(editor, removeWebKitStyles); } if (global$2.ie) { addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks); addPostProcessFilter(editor, removeUnderlineAndFontInAnchor); } }; var Quirks = { setup: setup$2 }; var stateChange = function (editor, clipboard, e) { var ctrl = e.control; ctrl.active(clipboard.pasteFormat.get() === 'text'); editor.on('PastePlainTextToggle', function (e) { ctrl.active(e.state); }); }; var register$2 = function (editor, clipboard) { var postRender = curry(stateChange, editor, clipboard); editor.addButton('pastetext', { active: false, icon: 'pastetext', tooltip: 'Paste as text', cmd: 'mceTogglePlainTextPaste', onPostRender: postRender }); editor.addMenuItem('pastetext', { text: 'Paste as text', selectable: true, active: clipboard.pasteFormat, cmd: 'mceTogglePlainTextPaste', onPostRender: postRender }); }; var Buttons = { register: register$2 }; global$1.add('paste', function (editor) { if (DetectProPlugin.hasProPlugin(editor) === false) { var userIsInformedState = Cell(false); var draggingInternallyState = Cell(false); var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html'); var clipboard = Clipboard(editor, pasteFormat); var quirks = Quirks.setup(editor); Buttons.register(editor, clipboard); Commands.register(editor, clipboard, userIsInformedState); PrePostProcess.setup(editor); CutCopy.register(editor); DragDrop.setup(editor, clipboard, draggingInternallyState); return Api.get(clipboard, quirks); } }); function Plugin () { } return Plugin; }(window)); })(); paste/plugin.min.js000064400000074165147331520370010320 0ustar00!function(v){"use strict";var p=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return p(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(t.settings.plugins)||!e.get("powerpaste")||("undefined"!=typeof v.window.console&&v.window.console.log&&v.window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},u=function(t,e){return{clipboard:t,quirks:e}},d=function(t,e,n,r){return t.fire("PastePreProcess",{content:e,internal:n,wordContent:r})},m=function(t,e,n,r){return t.fire("PastePostProcess",{node:e,internal:n,wordContent:r})},s=function(t,e){return t.fire("PastePlainTextToggle",{state:e})},n=function(t,e){return t.fire("paste",{ieFake:e})},g={shouldPlainTextInform:function(t){return t.getParam("paste_plaintext_inform",!0)},shouldBlockDrop:function(t){return t.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(t){return t.getParam("paste_data_images",!1)},shouldFilterDrop:function(t){return t.getParam("paste_filter_drop",!0)},getPreProcess:function(t){return t.getParam("paste_preprocess")},getPostProcess:function(t){return t.getParam("paste_postprocess")},getWebkitStyles:function(t){return t.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(t){return t.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(t){return t.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(t){return t.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(t){return t.getParam("paste_as_text",!1)},getRetainStyleProps:function(t){return t.getParam("paste_retain_style_properties")},getWordValidElements:function(t){return t.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(t){return t.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(t){return t.getParam("paste_enable_default_filters",!0)}},r=function(t,e,n){var r,o,i;"text"===e.pasteFormat.get()?(e.pasteFormat.set("html"),s(t,!1)):(e.pasteFormat.set("text"),s(t,!0),i=t,!1===n.get()&&g.shouldPlainTextInform(i)&&(o="Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",(r=t).notificationManager.open({text:r.translate(o),type:"info"}),n.set(!0))),t.focus()},c=function(t,n,e){t.addCommand("mceTogglePlainTextPaste",function(){r(t,n,e)}),t.addCommand("mceInsertClipboardContent",function(t,e){e.content&&n.pasteHtml(e.content,e.internal),e.text&&n.pasteText(e.text)})},h=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Delay"),b=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=tinymce.util.Tools.resolve("tinymce.util.VK"),t="x-tinymce/html",i="\x3c!-- "+t+" --\x3e",l=function(t){return i+t},f=function(t){return t.replace(i,"")},w=function(t){return-1!==t.indexOf(i)},x=function(){return t},_=tinymce.util.Tools.resolve("tinymce.html.Entities"),P=function(t){return t.replace(/\r?\n/g,"
")},T=function(t,e,n){var r=t.split(/\n\n/),o=function(t,e){var n,r=[],o="<"+t;if("object"==typeof e){for(n in e)e.hasOwnProperty(n)&&r.push(n+'="'+_.encodeAllRaw(e[n])+'"');r.length&&(o+=" "+r.join(" "))}return o+">"}(e,n),i="",a=b.map(r,function(t){return t.split(/\n/).join("
")});return 1===a.length?a[0]:b.map(a,function(t){return o+t+i}).join("")},D=function(t){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(t)},C=function(t,e,n){return e?T(t,e,n):P(t)},k=tinymce.util.Tools.resolve("tinymce.html.DomParser"),F=tinymce.util.Tools.resolve("tinymce.html.Serializer"),E=tinymce.util.Tools.resolve("tinymce.html.Node"),R=tinymce.util.Tools.resolve("tinymce.html.Schema");function I(e,t){return b.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}var O={filter:I,innerText:function(e){var n=R(),r=k({},n),o="",i=n.getShortEndedElements(),a=b.makeMap("script noscript style textarea video audio iframe object"," "),u=n.getBlockElements();return e=I(e,[//g]),function t(e){var n=e.name,r=e;if("br"!==n){if("wbr"!==n)if(i[n]&&(o+=" "),a[n])o+=" ";else{if(3===e.type&&(o+=e.value),!e.shortEnded&&(e=e.firstChild))for(;t(e),e=e.next;);u[n]&&r.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"}(r.parse(e)),o},trimHtml:function(t){return t=I(t,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,function(t,e,n){return e||n?"\xa0":" "}],/
/g,/
$/i])},createIdGenerator:function(t){var e=0;return function(){return t+e++}},isMsEdge:function(){return-1!==v.navigator.userAgent.indexOf(" Edge/")}};function S(e){var n,t;return t=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],e=e.replace(/^[\u00a0 ]+/,""),b.each(t,function(t){if(t.test(e))return!(n=!0)}),n}function A(t){var i,a,u=1;function n(t){var e="";if(3===t.type)return t.value;if(t=t.firstChild)for(;e+=n(t),t=t.next;);return e}function s(t,e){if(3===t.type&&e.test(t.value))return t.value=t.value.replace(e,""),!1;if(t=t.firstChild)do{if(!s(t,e))return!1}while(t=t.next);return!0}function e(e,n,r){var o=e._listLevel||u;o!==u&&(o/gi,/]+id="?docs-internal-[^>]*>/gi,//gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(t,e){return 0')}),!0);var r,o,i},tt=function(t,e){var n,r;!1===g.isSmartPasteEnabled(t)?X(t,e):(n=t,r=e,b.each([J,Q,X],function(t){return!0!==t(n,r,X)}))},et=function(){},nt=function(t){return function(){return t}},rt=nt(!1),ot=nt(!0),it=function(){return at},at=(M=function(t){return t.isNone()},B={fold:function(t,e){return t()},is:rt,isSome:rt,isNone:ot,getOr:N=function(t){return t},getOrThunk:L=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:nt(null),getOrUndefined:nt(undefined),or:N,orThunk:L,map:it,each:et,bind:it,exists:rt,forall:ot,filter:it,equals:M,equals_:M,toArray:function(){return[]},toString:nt("none()")},Object.freeze&&Object.freeze(B),B),ut=function(n){var t=nt(n),e=function(){return o},r=function(t){return t(n)},o={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:ot,isNone:rt,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:e,orThunk:e,map:function(t){return ut(t(n))},each:function(t){t(n)},bind:r,exists:r,forall:r,filter:function(t){return t(n)?o:at},toArray:function(){return[n]},toString:function(){return"some("+n+")"},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(rt,function(t){return e(n,t)})}};return o},st={some:ut,none:it,from:function(t){return null===t||t===undefined?at:ut(t)}},ct=(H="function",function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e}(t)===H}),lt=Array.prototype.slice,ft=function(t,e){for(var n=t.length,r=new Array(n),o=0;o=a.length&&r(o)}))})})},Pt=function(t,e){return n=ft(t,e),_t(n,xt);var n},Tt=function(t,e,n){var r=n||w(e),o=G(t,f(e),r);!1===o.cancelled&&tt(t,o.content)},Dt=function(t,e){e=t.dom.encode(e).replace(/\r\n/g,"\n"),e=C(e,t.settings.forced_root_block,t.settings.forced_root_block_attrs),Tt(t,e,!1)},Ct=function(t){var e={};if(t){if(t.getData){var n=t.getData("Text");n&&0',!1)}else Tt(t,'',!1)}(e,t)})}),!0}return!1},It=function(t){return o.metaKeyPressed(t)&&86===t.keyCode||t.shiftKey&&45===t.keyCode},Ot=function(s,c,l){var e,f,d=(e=p(st.none()),{clear:function(){e.set(st.none())},set:function(t){e.set(st.some(t))},isSet:function(){return e.get().isSome()},on:function(t){e.get().each(t)}});function m(t,e,n,r){var o,i;kt(t,"text/html")?o=t["text/html"]:(o=c.getHtml(),r=r||w(o),c.isDefaultContent(o)&&(n=!0)),o=O.trimHtml(o),c.remove(),i=!1===r&&D(o),o.length&&!i||(n=!0),n&&(o=kt(t,"text/plain")&&i?t["text/plain"]:O.innerText(o)),c.isDefaultContent(o)?e||s.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?Dt(s,o):Tt(s,o,r)}s.on("keydown",function(t){function e(t){It(t)&&!t.isDefaultPrevented()&&c.remove()}if(It(t)&&!t.isDefaultPrevented()){if((f=t.shiftKey&&86===t.keyCode)&&h.webkit&&-1!==v.navigator.userAgent.indexOf("Version/"))return;if(t.stopImmediatePropagation(),d.set(t),window.setTimeout(function(){d.clear()},100),h.ie&&f)return t.preventDefault(),void n(s,!0);c.remove(),c.create(),s.once("keyup",e),s.once("paste",function(){s.off("keyup",e)})}}),s.on("paste",function(t){var e,n,r,o=d.isSet(),i=(e=s,n=Ct(t.clipboardData||e.getDoc().dataTransfer),O.isMsEdge()?b.extend(n,{"text/html":""}):n),a="text"===l.get()||f,u=kt(i,x());f=!1,t.isDefaultPrevented()||(r=t.clipboardData,-1!==v.navigator.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length)?c.remove():Ft(i)||!Rt(s,t,c.getLastRng()||s.selection.getRng())?(o||t.preventDefault(),!h.ie||o&&!t.ieFake||kt(i,"text/html")||(c.create(),s.dom.bind(c.getEl(),"paste",function(t){t.stopPropagation()}),s.getDoc().execCommand("Paste",!1,null),i["text/html"]=c.getHtml()),kt(i,"text/html")?(t.preventDefault(),u||(u=w(i["text/html"])),m(i,o,a,u)):y.setEditorTimeout(s,function(){m(i,o,a,u)},0)):c.remove()})},St=function(t){return h.ie&&t.inline?v.document.body:t.getBody()},At=function(e,t,n){var r;St(r=e)!==r.getBody()&&e.dom.bind(t,"paste keyup",function(t){Lt(e,n)||e.fire("paste")})},jt=function(t){return t.dom.get("mcepastebin")},Mt=function(t,e){return e===t},Lt=function(t,e){var n,r=jt(t);return(n=r)&&"mcepastebin"===n.id&&Mt(e,r.innerHTML)},Nt=function(a){var u=p(null),s="%MCEPASTEBIN%";return{create:function(){return e=u,n=s,o=(t=a).dom,i=t.getBody(),e.set(t.selection.getRng()),r=t.dom.add(St(t),"div",{id:"mcepastebin","class":"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},n),(h.ie||h.gecko)&&o.setStyle(r,"left","rtl"===o.getStyle(i,"direction",!0)?65535:-65535),o.bind(r,"beforedeactivate focusin focusout",function(t){t.stopPropagation()}),At(t,r,n),r.focus(),void t.selection.select(r,!0);var t,e,n,r,o,i},remove:function(){return function(t,e){if(jt(t)){for(var n=void 0,r=e.get();n=t.dom.get("mcepastebin");)t.dom.remove(n),t.dom.unbind(n);r&&t.selection.setRng(r)}e.set(null)}(a,u)},getEl:function(){return jt(a)},getHtml:function(){return function(n){var e,t,r,o,i,a=function(t,e){t.appendChild(e),n.dom.remove(e,!0)};for(t=b.grep(St(n).childNodes,function(t){return"mcepastebin"===t.id}),e=t.shift(),b.each(t,function(t){a(e,t)}),r=(o=n.dom.select("div[id=mcepastebin]",e)).length-1;0<=r;r--)i=n.dom.create("div"),e.insertBefore(i,o[r]),a(i,o[r]);return e?e.innerHTML:""}(a)},getLastRng:function(){return u.get()},isDefault:function(){return Lt(a,s)},isDefaultContent:function(t){return Mt(s,t)}}},Bt=function(n,t){var e=Nt(n);return n.on("preInit",function(){return Ot(a=n,e,t),void a.parser.addNodeFilter("img",function(t,e,n){var r,o=function(t){t.attr("data-mce-object")||u===h.transparentSrc||t.remove()};if(!a.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=t.length;i--;)(u=t[i].attributes.map.src)&&(0===u.indexOf("webkit-fake-url")?o(t[i]):a.settings.allow_html_data_urls||0!==u.indexOf("data:")||o(t[i]))});var a,u}),{pasteFormat:t,pasteHtml:function(t,e){return Tt(n,t,e)},pasteText:function(t){return Dt(n,t)},pasteImageData:function(t,e){return Rt(n,t,e)},getDataTransferItems:Ct,hasHtmlOrText:Ft,hasContentType:kt}},Ht=function(){},$t=function(t,e,n){if(r=t,!1!==h.iOS||r===undefined||"function"!=typeof r.setData||!0===O.isMsEdge())return!1;try{return t.clearData(),t.setData("text/html",e),t.setData("text/plain",n),t.setData(x(),e),!0}catch(o){return!1}var r},Wt=function(t,e,n,r){$t(t.clipboardData,e.html,e.text)?(t.preventDefault(),r()):n(e.html,r)},Ut=function(u){return function(t,e){var n=l(t),r=u.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),o=u.dom.create("div",{contenteditable:"true"},n);u.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(o),u.dom.add(u.getBody(),r);var i=u.selection.getRng();o.focus();var a=u.dom.createRng();a.selectNodeContents(o),u.selection.setRng(a),setTimeout(function(){u.selection.setRng(i),r.parentNode.removeChild(r),e()},0)}},zt=function(t){return{html:t.selection.getContent({contextual:!0}),text:t.selection.getContent({format:"text"})}},Vt=function(t){return!t.selection.isCollapsed()||!!(e=t).dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody());var e},Kt=function(t){var e,n;t.on("cut",(e=t,function(t){Vt(e)&&Wt(t,zt(e),Ut(e),function(){setTimeout(function(){e.execCommand("Delete")},0)})})),t.on("copy",(n=t,function(t){Vt(n)&&Wt(t,zt(n),Ut(n),Ht)}))},qt=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Gt=function(t,e){return qt.getCaretRangeFromPoint(e.clientX,e.clientY,t.getDoc())},Xt=function(t,e){t.focus(),t.selection.setRng(e)},Yt=function(a,u,s){g.shouldBlockDrop(a)&&a.on("dragend dragover draggesture dragdrop drop drag",function(t){t.preventDefault(),t.stopPropagation()}),g.shouldPasteDataImages(a)||a.on("drop",function(t){var e=t.dataTransfer;e&&e.files&&0 [\\s\\r\\n]+|
)*(<\\/?("+n.join("|")+")[^>]*>)(?:
 [\\s\\r\\n]+|
)*","g");return e=O.filter(e,[[r,"$1"]]),e=O.filter(e,[[/

/g,"

"],[/
/g," "],[/

/g,"
"]])}function te(t,e,n,r){if(r||n)return e;var c,o=g.getWebkitStyles(t);if(!1===g.shouldRemoveWebKitStyles(t)||"all"===o)return e;if(o&&(c=o.split(/[, ]/)),c){var l=t.dom,f=t.selection.getNode();e=e.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(t,e,n,r){var o=l.parseStyle(l.decode(n)),i={};if("none"===c)return e+r;for(var a=0;a]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return e=e.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(t,e,n,r){return e+' style="'+n+'"'+r})}function ee(n,t){n.$("a",t).find("font,u").each(function(t,e){n.dom.remove(e,!0)})}var ne=function(t){var e,n;h.webkit&&Jt(t,te),h.ie&&(Jt(t,Qt),n=ee,(e=t).on("PastePostProcess",function(t){n(e,t.node)}))},re=function(t,e,n){var r=n.control;r.active("text"===e.pasteFormat.get()),t.on("PastePlainTextToggle",function(t){r.active(t.state)})},oe=function(t,e){var n=function(r){for(var o=[],t=1;t 0) { return false; } return empty; }; var isChildOfBody = function (dom, elm) { return dom.isChildOf(elm, dom.getRoot()); }; var NodeType = { isTextNode: isTextNode, isListNode: isListNode, isOlUlNode: isOlUlNode, isDlItemNode: isDlItemNode, isListItemNode: isListItemNode, isTableCellNode: isTableCellNode, isBr: isBr, isFirstChild: isFirstChild, isLastChild: isLastChild, isTextBlock: isTextBlock, isBlock: isBlock, isBogusBr: isBogusBr, isEmpty: isEmpty, isChildOfBody: isChildOfBody }; var getNormalizedPoint = function (container, offset) { if (NodeType.isTextNode(container)) { return { container: container, offset: offset }; } var node = global$1.getNode(container, offset); if (NodeType.isTextNode(node)) { return { container: node, offset: offset >= container.childNodes.length ? node.data.length : 0 }; } else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) { return { container: node.previousSibling, offset: node.previousSibling.data.length }; } else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) { return { container: node.nextSibling, offset: 0 }; } return { container: container, offset: offset }; }; var normalizeRange = function (rng) { var outRng = rng.cloneRange(); var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset); outRng.setStart(rangeStart.container, rangeStart.offset); var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset); outRng.setEnd(rangeEnd.container, rangeEnd.offset); return outRng; }; var Range = { getNormalizedPoint: getNormalizedPoint, normalizeRange: normalizeRange }; var DOM = global$6.DOM; var createBookmark = function (rng) { var bookmark = {}; var setupEndPoint = function (start) { var offsetNode, container, offset; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; if (container.nodeType === 1) { offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' }); if (container.hasChildNodes()) { offset = Math.min(offset, container.childNodes.length - 1); if (start) { container.insertBefore(offsetNode, container.childNodes[offset]); } else { DOM.insertAfter(offsetNode, container.childNodes[offset]); } } else { container.appendChild(offsetNode); } container = offsetNode; offset = 0; } bookmark[start ? 'startContainer' : 'endContainer'] = container; bookmark[start ? 'startOffset' : 'endOffset'] = offset; }; setupEndPoint(true); if (!rng.collapsed) { setupEndPoint(); } return bookmark; }; var resolveBookmark = function (bookmark) { function restoreEndPoint(start) { var container, offset, node; var nodeIndex = function (container) { var node = container.parentNode.firstChild, idx = 0; while (node) { if (node === container) { return idx; } if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') { idx++; } node = node.nextSibling; } return -1; }; container = node = bookmark[start ? 'startContainer' : 'endContainer']; offset = bookmark[start ? 'startOffset' : 'endOffset']; if (!container) { return; } if (container.nodeType === 1) { offset = nodeIndex(container); container = container.parentNode; DOM.remove(node); if (!container.hasChildNodes() && DOM.isBlock(container)) { container.appendChild(DOM.create('br')); } } bookmark[start ? 'startContainer' : 'endContainer'] = container; bookmark[start ? 'startOffset' : 'endOffset'] = offset; } restoreEndPoint(true); restoreEndPoint(); var rng = DOM.createRng(); rng.setStart(bookmark.startContainer, bookmark.startOffset); if (bookmark.endContainer) { rng.setEnd(bookmark.endContainer, bookmark.endOffset); } return Range.normalizeRange(rng); }; var Bookmark = { createBookmark: createBookmark, resolveBookmark: resolveBookmark }; var noop = function () { }; var constant = function (value) { return function () { return value; }; }; var not = function (f) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return !f.apply(null, args); }; }; var never = constant(false); var always = constant(true); var none = function () { return NONE; }; var NONE = function () { var eq = function (o) { return o.isNone(); }; var call = function (thunk) { return thunk(); }; var id = function (n) { return n; }; var me = { fold: function (n, s) { return n(); }, is: never, isSome: never, isNone: always, getOr: id, getOrThunk: call, getOrDie: function (msg) { throw new Error(msg || 'error: getOrDie called on none.'); }, getOrNull: constant(null), getOrUndefined: constant(undefined), or: id, orThunk: call, map: none, each: noop, bind: none, exists: never, forall: always, filter: none, equals: eq, equals_: eq, toArray: function () { return []; }, toString: constant('none()') }; if (Object.freeze) { Object.freeze(me); } return me; }(); var some = function (a) { var constant_a = constant(a); var self = function () { return me; }; var bind = function (f) { return f(a); }; var me = { fold: function (n, s) { return s(a); }, is: function (v) { return a === v; }, isSome: always, isNone: never, getOr: constant_a, getOrThunk: constant_a, getOrDie: constant_a, getOrNull: constant_a, getOrUndefined: constant_a, or: self, orThunk: self, map: function (f) { return some(f(a)); }, each: function (f) { f(a); }, bind: bind, exists: bind, forall: bind, filter: function (f) { return f(a) ? me : NONE; }, toArray: function () { return [a]; }, toString: function () { return 'some(' + a + ')'; }, equals: function (o) { return o.is(a); }, equals_: function (o, elementEq) { return o.fold(never, function (b) { return elementEq(a, b); }); } }; return me; }; var from = function (value) { return value === null || value === undefined ? NONE : some(value); }; var Option = { some: some, none: none, from: from }; var typeOf = function (x) { if (x === null) { return 'null'; } var t = typeof x; if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { return 'array'; } if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { return 'string'; } return t; }; var isType = function (type) { return function (value) { return typeOf(value) === type; }; }; var isString = isType('string'); var isArray = isType('array'); var isBoolean = isType('boolean'); var isFunction = isType('function'); var isNumber = isType('number'); var nativeSlice = Array.prototype.slice; var nativePush = Array.prototype.push; var map = function (xs, f) { var len = xs.length; var r = new Array(len); for (var i = 0; i < len; i++) { var x = xs[i]; r[i] = f(x, i); } return r; }; var each = function (xs, f) { for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; f(x, i); } }; var filter = function (xs, pred) { var r = []; for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; if (pred(x, i)) { r.push(x); } } return r; }; var groupBy = function (xs, f) { if (xs.length === 0) { return []; } else { var wasType = f(xs[0]); var r = []; var group = []; for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; var type = f(x); if (type !== wasType) { r.push(group); group = []; } wasType = type; group.push(x); } if (group.length !== 0) { r.push(group); } return r; } }; var foldl = function (xs, f, acc) { each(xs, function (x) { acc = f(acc, x); }); return acc; }; var find = function (xs, pred) { for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; if (pred(x, i)) { return Option.some(x); } } return Option.none(); }; var flatten = function (xs) { var r = []; for (var i = 0, len = xs.length; i < len; ++i) { if (!isArray(xs[i])) { throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); } nativePush.apply(r, xs[i]); } return r; }; var bind = function (xs, f) { var output = map(xs, f); return flatten(output); }; var reverse = function (xs) { var r = nativeSlice.call(xs, 0); r.reverse(); return r; }; var head = function (xs) { return xs.length === 0 ? Option.none() : Option.some(xs[0]); }; var last = function (xs) { return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]); }; var from$1 = isFunction(Array.from) ? Array.from : function (x) { return nativeSlice.call(x); }; var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')(); var path = function (parts, scope) { var o = scope !== undefined && scope !== null ? scope : Global; for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) { o = o[parts[i]]; } return o; }; var resolve = function (p, scope) { var parts = p.split('.'); return path(parts, scope); }; var unsafe = function (name, scope) { return resolve(name, scope); }; var getOrDie = function (name, scope) { var actual = unsafe(name, scope); if (actual === undefined || actual === null) { throw new Error(name + ' not available on this browser'); } return actual; }; var Global$1 = { getOrDie: getOrDie }; var htmlElement = function (scope) { return Global$1.getOrDie('HTMLElement', scope); }; var isPrototypeOf = function (x) { var scope = resolve('ownerDocument.defaultView', x); return htmlElement(scope).prototype.isPrototypeOf(x); }; var HTMLElement = { isPrototypeOf: isPrototypeOf }; var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery'); var getParentList = function (editor) { var selectionStart = editor.selection.getStart(true); return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart)); }; var isParentListSelected = function (parentList, selectedBlocks) { return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList; }; var findSubLists = function (parentList) { return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) { return NodeType.isListNode(elm); }); }; var getSelectedSubLists = function (editor) { var parentList = getParentList(editor); var selectedBlocks = editor.selection.getSelectedBlocks(); if (isParentListSelected(parentList, selectedBlocks)) { return findSubLists(parentList); } else { return global$5.grep(selectedBlocks, function (elm) { return NodeType.isListNode(elm) && parentList !== elm; }); } }; var findParentListItemsNodes = function (editor, elms) { var listItemsElms = global$5.map(elms, function (elm) { var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm)); return parentLi ? parentLi : elm; }); return global$7.unique(listItemsElms); }; var getSelectedListItems = function (editor) { var selectedBlocks = editor.selection.getSelectedBlocks(); return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) { return NodeType.isListItemNode(block); }); }; var getSelectedDlItems = function (editor) { return filter(getSelectedListItems(editor), NodeType.isDlItemNode); }; var getClosestListRootElm = function (editor, elm) { var parentTableCell = editor.dom.getParents(elm, 'TD,TH'); var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody(); return root; }; var findLastParentListNode = function (editor, elm) { var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm)); return last(parentLists); }; var getSelectedLists = function (editor) { var firstList = findLastParentListNode(editor, editor.selection.getStart()); var subsequentLists = filter(editor.selection.getSelectedBlocks(), NodeType.isOlUlNode); return firstList.toArray().concat(subsequentLists); }; var getSelectedListRoots = function (editor) { var selectedLists = getSelectedLists(editor); return getUniqueListRoots(editor, selectedLists); }; var getUniqueListRoots = function (editor, lists) { var listRoots = map(lists, function (list) { return findLastParentListNode(editor, list).getOr(list); }); return global$7.unique(listRoots); }; var isList = function (editor) { var list = getParentList(editor); return HTMLElement.isPrototypeOf(list); }; var Selection = { isList: isList, getParentList: getParentList, getSelectedSubLists: getSelectedSubLists, getSelectedListItems: getSelectedListItems, getClosestListRootElm: getClosestListRootElm, getSelectedDlItems: getSelectedDlItems, getSelectedListRoots: getSelectedListRoots }; var fromHtml = function (html, scope) { var doc = scope || domGlobals.document; var div = doc.createElement('div'); div.innerHTML = html; if (!div.hasChildNodes() || div.childNodes.length > 1) { domGlobals.console.error('HTML does not have a single root node', html); throw new Error('HTML must have a single root node'); } return fromDom(div.childNodes[0]); }; var fromTag = function (tag, scope) { var doc = scope || domGlobals.document; var node = doc.createElement(tag); return fromDom(node); }; var fromText = function (text, scope) { var doc = scope || domGlobals.document; var node = doc.createTextNode(text); return fromDom(node); }; var fromDom = function (node) { if (node === null || node === undefined) { throw new Error('Node cannot be null or undefined'); } return { dom: constant(node) }; }; var fromPoint = function (docElm, x, y) { var doc = docElm.dom(); return Option.from(doc.elementFromPoint(x, y)).map(fromDom); }; var Element = { fromHtml: fromHtml, fromTag: fromTag, fromText: fromText, fromDom: fromDom, fromPoint: fromPoint }; var lift2 = function (oa, ob, f) { return oa.isSome() && ob.isSome() ? Option.some(f(oa.getOrDie(), ob.getOrDie())) : Option.none(); }; var fromElements = function (elements, scope) { var doc = scope || domGlobals.document; var fragment = doc.createDocumentFragment(); each(elements, function (element) { fragment.appendChild(element.dom()); }); return Element.fromDom(fragment); }; var Immutable = function () { var fields = []; for (var _i = 0; _i < arguments.length; _i++) { fields[_i] = arguments[_i]; } return function () { var values = []; for (var _i = 0; _i < arguments.length; _i++) { values[_i] = arguments[_i]; } if (fields.length !== values.length) { throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments'); } var struct = {}; each(fields, function (name, i) { struct[name] = constant(values[i]); }); return struct; }; }; var keys = Object.keys; var each$1 = function (obj, f) { var props = keys(obj); for (var k = 0, len = props.length; k < len; k++) { var i = props[k]; var x = obj[i]; f(x, i); } }; var node = function () { var f = Global$1.getOrDie('Node'); return f; }; var compareDocumentPosition = function (a, b, match) { return (a.compareDocumentPosition(b) & match) !== 0; }; var documentPositionPreceding = function (a, b) { return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING); }; var documentPositionContainedBy = function (a, b) { return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY); }; var Node = { documentPositionPreceding: documentPositionPreceding, documentPositionContainedBy: documentPositionContainedBy }; var cached = function (f) { var called = false; var r; return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!called) { called = true; r = f.apply(null, args); } return r; }; }; var firstMatch = function (regexes, s) { for (var i = 0; i < regexes.length; i++) { var x = regexes[i]; if (x.test(s)) { return x; } } return undefined; }; var find$1 = function (regexes, agent) { var r = firstMatch(regexes, agent); if (!r) { return { major: 0, minor: 0 }; } var group = function (i) { return Number(agent.replace(r, '$' + i)); }; return nu(group(1), group(2)); }; var detect = function (versionRegexes, agent) { var cleanedAgent = String(agent).toLowerCase(); if (versionRegexes.length === 0) { return unknown(); } return find$1(versionRegexes, cleanedAgent); }; var unknown = function () { return nu(0, 0); }; var nu = function (major, minor) { return { major: major, minor: minor }; }; var Version = { nu: nu, detect: detect, unknown: unknown }; var edge = 'Edge'; var chrome = 'Chrome'; var ie = 'IE'; var opera = 'Opera'; var firefox = 'Firefox'; var safari = 'Safari'; var isBrowser = function (name, current) { return function () { return current === name; }; }; var unknown$1 = function () { return nu$1({ current: undefined, version: Version.unknown() }); }; var nu$1 = function (info) { var current = info.current; var version = info.version; return { current: current, version: version, isEdge: isBrowser(edge, current), isChrome: isBrowser(chrome, current), isIE: isBrowser(ie, current), isOpera: isBrowser(opera, current), isFirefox: isBrowser(firefox, current), isSafari: isBrowser(safari, current) }; }; var Browser = { unknown: unknown$1, nu: nu$1, edge: constant(edge), chrome: constant(chrome), ie: constant(ie), opera: constant(opera), firefox: constant(firefox), safari: constant(safari) }; var windows = 'Windows'; var ios = 'iOS'; var android = 'Android'; var linux = 'Linux'; var osx = 'OSX'; var solaris = 'Solaris'; var freebsd = 'FreeBSD'; var isOS = function (name, current) { return function () { return current === name; }; }; var unknown$2 = function () { return nu$2({ current: undefined, version: Version.unknown() }); }; var nu$2 = function (info) { var current = info.current; var version = info.version; return { current: current, version: version, isWindows: isOS(windows, current), isiOS: isOS(ios, current), isAndroid: isOS(android, current), isOSX: isOS(osx, current), isLinux: isOS(linux, current), isSolaris: isOS(solaris, current), isFreeBSD: isOS(freebsd, current) }; }; var OperatingSystem = { unknown: unknown$2, nu: nu$2, windows: constant(windows), ios: constant(ios), android: constant(android), linux: constant(linux), osx: constant(osx), solaris: constant(solaris), freebsd: constant(freebsd) }; var DeviceType = function (os, browser, userAgent) { var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; var isiPhone = os.isiOS() && !isiPad; var isAndroid3 = os.isAndroid() && os.version.major === 3; var isAndroid4 = os.isAndroid() && os.version.major === 4; var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true; var isTouch = os.isiOS() || os.isAndroid(); var isPhone = isTouch && !isTablet; var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; return { isiPad: constant(isiPad), isiPhone: constant(isiPhone), isTablet: constant(isTablet), isPhone: constant(isPhone), isTouch: constant(isTouch), isAndroid: os.isAndroid, isiOS: os.isiOS, isWebView: constant(iOSwebview) }; }; var detect$1 = function (candidates, userAgent) { var agent = String(userAgent).toLowerCase(); return find(candidates, function (candidate) { return candidate.search(agent); }); }; var detectBrowser = function (browsers, userAgent) { return detect$1(browsers, userAgent).map(function (browser) { var version = Version.detect(browser.versionRegexes, userAgent); return { current: browser.name, version: version }; }); }; var detectOs = function (oses, userAgent) { return detect$1(oses, userAgent).map(function (os) { var version = Version.detect(os.versionRegexes, userAgent); return { current: os.name, version: version }; }); }; var UaString = { detectBrowser: detectBrowser, detectOs: detectOs }; var contains = function (str, substr) { return str.indexOf(substr) !== -1; }; var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; var checkContains = function (target) { return function (uastring) { return contains(uastring, target); }; }; var browsers = [ { name: 'Edge', versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], search: function (uastring) { return contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit'); } }, { name: 'Chrome', versionRegexes: [ /.*?chrome\/([0-9]+)\.([0-9]+).*/, normalVersionRegex ], search: function (uastring) { return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe'); } }, { name: 'IE', versionRegexes: [ /.*?msie\ ?([0-9]+)\.([0-9]+).*/, /.*?rv:([0-9]+)\.([0-9]+).*/ ], search: function (uastring) { return contains(uastring, 'msie') || contains(uastring, 'trident'); } }, { name: 'Opera', versionRegexes: [ normalVersionRegex, /.*?opera\/([0-9]+)\.([0-9]+).*/ ], search: checkContains('opera') }, { name: 'Firefox', versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], search: checkContains('firefox') }, { name: 'Safari', versionRegexes: [ normalVersionRegex, /.*?cpu os ([0-9]+)_([0-9]+).*/ ], search: function (uastring) { return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit'); } } ]; var oses = [ { name: 'Windows', search: checkContains('win'), versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] }, { name: 'iOS', search: function (uastring) { return contains(uastring, 'iphone') || contains(uastring, 'ipad'); }, versionRegexes: [ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, /.*cpu os ([0-9]+)_([0-9]+).*/, /.*cpu iphone os ([0-9]+)_([0-9]+).*/ ] }, { name: 'Android', search: checkContains('android'), versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] }, { name: 'OSX', search: checkContains('os x'), versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/] }, { name: 'Linux', search: checkContains('linux'), versionRegexes: [] }, { name: 'Solaris', search: checkContains('sunos'), versionRegexes: [] }, { name: 'FreeBSD', search: checkContains('freebsd'), versionRegexes: [] } ]; var PlatformInfo = { browsers: constant(browsers), oses: constant(oses) }; var detect$2 = function (userAgent) { var browsers = PlatformInfo.browsers(); var oses = PlatformInfo.oses(); var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu); var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); var deviceType = DeviceType(os, browser, userAgent); return { browser: browser, os: os, deviceType: deviceType }; }; var PlatformDetection = { detect: detect$2 }; var detect$3 = cached(function () { var userAgent = domGlobals.navigator.userAgent; return PlatformDetection.detect(userAgent); }); var PlatformDetection$1 = { detect: detect$3 }; var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE; var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE; var COMMENT = domGlobals.Node.COMMENT_NODE; var DOCUMENT = domGlobals.Node.DOCUMENT_NODE; var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE; var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE; var ELEMENT = domGlobals.Node.ELEMENT_NODE; var TEXT = domGlobals.Node.TEXT_NODE; var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE; var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE; var ENTITY = domGlobals.Node.ENTITY_NODE; var NOTATION = domGlobals.Node.NOTATION_NODE; var ELEMENT$1 = ELEMENT; var is = function (element, selector) { var dom = element.dom(); if (dom.nodeType !== ELEMENT$1) { return false; } else { var elem = dom; if (elem.matches !== undefined) { return elem.matches(selector); } else if (elem.msMatchesSelector !== undefined) { return elem.msMatchesSelector(selector); } else if (elem.webkitMatchesSelector !== undefined) { return elem.webkitMatchesSelector(selector); } else if (elem.mozMatchesSelector !== undefined) { return elem.mozMatchesSelector(selector); } else { throw new Error('Browser lacks native selectors'); } } }; var eq = function (e1, e2) { return e1.dom() === e2.dom(); }; var regularContains = function (e1, e2) { var d1 = e1.dom(); var d2 = e2.dom(); return d1 === d2 ? false : d1.contains(d2); }; var ieContains = function (e1, e2) { return Node.documentPositionContainedBy(e1.dom(), e2.dom()); }; var browser = PlatformDetection$1.detect().browser; var contains$1 = browser.isIE() ? ieContains : regularContains; var is$1 = is; var parent = function (element) { return Option.from(element.dom().parentNode).map(Element.fromDom); }; var children = function (element) { return map(element.dom().childNodes, Element.fromDom); }; var child = function (element, index) { var cs = element.dom().childNodes; return Option.from(cs[index]).map(Element.fromDom); }; var firstChild = function (element) { return child(element, 0); }; var lastChild = function (element) { return child(element, element.dom().childNodes.length - 1); }; var spot = Immutable('element', 'offset'); var before = function (marker, element) { var parent$1 = parent(marker); parent$1.each(function (v) { v.dom().insertBefore(element.dom(), marker.dom()); }); }; var append = function (parent, element) { parent.dom().appendChild(element.dom()); }; var before$1 = function (marker, elements) { each(elements, function (x) { before(marker, x); }); }; var append$1 = function (parent, elements) { each(elements, function (x) { append(parent, x); }); }; var remove = function (element) { var dom = element.dom(); if (dom.parentNode !== null) { dom.parentNode.removeChild(dom); } }; var name = function (element) { var r = element.dom().nodeName; return r.toLowerCase(); }; var type = function (element) { return element.dom().nodeType; }; var isType$1 = function (t) { return function (element) { return type(element) === t; }; }; var isElement = isType$1(ELEMENT); var rawSet = function (dom, key, value) { if (isString(value) || isBoolean(value) || isNumber(value)) { dom.setAttribute(key, value + ''); } else { domGlobals.console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom); throw new Error('Attribute value was not simple'); } }; var setAll = function (element, attrs) { var dom = element.dom(); each$1(attrs, function (v, k) { rawSet(dom, k, v); }); }; var clone = function (element) { return foldl(element.dom().attributes, function (acc, attr) { acc[attr.name] = attr.value; return acc; }, {}); }; var isSupported = function (dom) { return dom.style !== undefined && isFunction(dom.style.getPropertyValue); }; var internalSet = function (dom, property, value) { if (!isString(value)) { domGlobals.console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom); throw new Error('CSS value must be a string: ' + value); } if (isSupported(dom)) { dom.style.setProperty(property, value); } }; var set = function (element, property, value) { var dom = element.dom(); internalSet(dom, property, value); }; var clone$1 = function (original, isDeep) { return Element.fromDom(original.dom().cloneNode(isDeep)); }; var deep = function (original) { return clone$1(original, true); }; var shallowAs = function (original, tag) { var nu = Element.fromTag(tag); var attributes = clone(original); setAll(nu, attributes); return nu; }; var mutate = function (original, tag) { var nu = shallowAs(original, tag); before(original, nu); var children$1 = children(original); append$1(nu, children$1); remove(original); return nu; }; var joinSegment = function (parent, child) { append(parent.item, child.list); }; var joinSegments = function (segments) { for (var i = 1; i < segments.length; i++) { joinSegment(segments[i - 1], segments[i]); } }; var appendSegments = function (head$1, tail) { lift2(last(head$1), head(tail), joinSegment); }; var createSegment = function (scope, listType) { var segment = { list: Element.fromTag(listType, scope), item: Element.fromTag('li', scope) }; append(segment.list, segment.item); return segment; }; var createSegments = function (scope, entry, size) { var segments = []; for (var i = 0; i < size; i++) { segments.push(createSegment(scope, entry.listType)); } return segments; }; var populateSegments = function (segments, entry) { for (var i = 0; i < segments.length - 1; i++) { set(segments[i].item, 'list-style-type', 'none'); } last(segments).each(function (segment) { setAll(segment.list, entry.listAttributes); setAll(segment.item, entry.itemAttributes); append$1(segment.item, entry.content); }); }; var normalizeSegment = function (segment, entry) { if (name(segment.list) !== entry.listType) { segment.list = mutate(segment.list, entry.listType); } setAll(segment.list, entry.listAttributes); }; var createItem = function (scope, attr, content) { var item = Element.fromTag('li', scope); setAll(item, attr); append$1(item, content); return item; }; var appendItem = function (segment, item) { append(segment.list, item); segment.item = item; }; var writeShallow = function (scope, cast, entry) { var newCast = cast.slice(0, entry.depth); last(newCast).each(function (segment) { var item = createItem(scope, entry.itemAttributes, entry.content); appendItem(segment, item); normalizeSegment(segment, entry); }); return newCast; }; var writeDeep = function (scope, cast, entry) { var segments = createSegments(scope, entry, entry.depth - cast.length); joinSegments(segments); populateSegments(segments, entry); appendSegments(cast, segments); return cast.concat(segments); }; var composeList = function (scope, entries) { var cast = foldl(entries, function (cast, entry) { return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry); }, []); return head(cast).map(function (segment) { return segment.list; }); }; var isList$1 = function (el) { return is$1(el, 'OL,UL'); }; var hasFirstChildList = function (el) { return firstChild(el).map(isList$1).getOr(false); }; var hasLastChildList = function (el) { return lastChild(el).map(isList$1).getOr(false); }; var isIndented = function (entry) { return entry.depth > 0; }; var isSelected = function (entry) { return entry.isSelected; }; var cloneItemContent = function (li) { var children$1 = children(li); var content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1; return map(content, deep); }; var createEntry = function (li, depth, isSelected) { return parent(li).filter(isElement).map(function (list) { return { depth: depth, isSelected: isSelected, content: cloneItemContent(li), itemAttributes: clone(li), listAttributes: clone(list), listType: name(list) }; }); }; var indentEntry = function (indentation, entry) { switch (indentation) { case 'Indent': entry.depth++; break; case 'Outdent': entry.depth--; break; case 'Flatten': entry.depth = 0; } }; var hasOwnProperty = Object.prototype.hasOwnProperty; var shallow = function (old, nu) { return nu; }; var baseMerge = function (merger) { return function () { var objects = new Array(arguments.length); for (var i = 0; i < objects.length; i++) { objects[i] = arguments[i]; } if (objects.length === 0) { throw new Error('Can\'t merge zero objects'); } var ret = {}; for (var j = 0; j < objects.length; j++) { var curObject = objects[j]; for (var key in curObject) { if (hasOwnProperty.call(curObject, key)) { ret[key] = merger(ret[key], curObject[key]); } } } return ret; }; }; var merge = baseMerge(shallow); var cloneListProperties = function (target, source) { target.listType = source.listType; target.listAttributes = merge({}, source.listAttributes); }; var previousSiblingEntry = function (entries, start) { var depth = entries[start].depth; for (var i = start - 1; i >= 0; i--) { if (entries[i].depth === depth) { return Option.some(entries[i]); } if (entries[i].depth < depth) { break; } } return Option.none(); }; var normalizeEntries = function (entries) { each(entries, function (entry, i) { previousSiblingEntry(entries, i).each(function (matchingEntry) { cloneListProperties(entry, matchingEntry); }); }); }; var Cell = function (initial) { var value = initial; var get = function () { return value; }; var set = function (v) { value = v; }; var clone = function () { return Cell(get()); }; return { get: get, set: set, clone: clone }; }; var parseItem = function (depth, itemSelection, selectionState, item) { return firstChild(item).filter(isList$1).fold(function () { itemSelection.each(function (selection) { if (eq(selection.start, item)) { selectionState.set(true); } }); var currentItemEntry = createEntry(item, depth, selectionState.get()); itemSelection.each(function (selection) { if (eq(selection.end, item)) { selectionState.set(false); } }); var childListEntries = lastChild(item).filter(isList$1).map(function (list) { return parseList(depth, itemSelection, selectionState, list); }).getOr([]); return currentItemEntry.toArray().concat(childListEntries); }, function (list) { return parseList(depth, itemSelection, selectionState, list); }); }; var parseList = function (depth, itemSelection, selectionState, list) { return bind(children(list), function (element) { var parser = isList$1(element) ? parseList : parseItem; var newDepth = depth + 1; return parser(newDepth, itemSelection, selectionState, element); }); }; var parseLists = function (lists, itemSelection) { var selectionState = Cell(false); var initialDepth = 0; return map(lists, function (list) { return { sourceList: list, entries: parseList(initialDepth, itemSelection, selectionState, list) }; }); }; var global$8 = tinymce.util.Tools.resolve('tinymce.Env'); var createTextBlock = function (editor, contentNode) { var dom = editor.dom; var blockElements = editor.schema.getBlockElements(); var fragment = dom.createFragment(); var node, textBlock, blockName, hasContentNode; if (editor.settings.forced_root_block) { blockName = editor.settings.forced_root_block; } if (blockName) { textBlock = dom.create(blockName); if (textBlock.tagName === editor.settings.forced_root_block) { dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs); } if (!NodeType.isBlock(contentNode.firstChild, blockElements)) { fragment.appendChild(textBlock); } } if (contentNode) { while (node = contentNode.firstChild) { var nodeName = node.nodeName; if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) { hasContentNode = true; } if (NodeType.isBlock(node, blockElements)) { fragment.appendChild(node); textBlock = null; } else { if (blockName) { if (!textBlock) { textBlock = dom.create(blockName); fragment.appendChild(textBlock); } textBlock.appendChild(node); } else { fragment.appendChild(node); } } } } if (!editor.settings.forced_root_block) { fragment.appendChild(dom.create('br')); } else { if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) { textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' })); } } return fragment; }; var outdentedComposer = function (editor, entries) { return map(entries, function (entry) { var content = fromElements(entry.content); return Element.fromDom(createTextBlock(editor, content.dom())); }); }; var indentedComposer = function (editor, entries) { normalizeEntries(entries); return composeList(editor.contentDocument, entries).toArray(); }; var composeEntries = function (editor, entries) { return bind(groupBy(entries, isIndented), function (entries) { var groupIsIndented = head(entries).map(isIndented).getOr(false); return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries); }); }; var indentSelectedEntries = function (entries, indentation) { each(filter(entries, isSelected), function (entry) { return indentEntry(indentation, entry); }); }; var getItemSelection = function (editor) { var selectedListItems = map(Selection.getSelectedListItems(editor), Element.fromDom); return lift2(find(selectedListItems, not(hasFirstChildList)), find(reverse(selectedListItems), not(hasFirstChildList)), function (start, end) { return { start: start, end: end }; }); }; var listsIndentation = function (editor, lists, indentation) { var entrySets = parseLists(lists, getItemSelection(editor)); each(entrySets, function (entrySet) { indentSelectedEntries(entrySet.entries, indentation); before$1(entrySet.sourceList, composeEntries(editor, entrySet.entries)); remove(entrySet.sourceList); }); }; var DOM$1 = global$6.DOM; var splitList = function (editor, ul, li) { var tmpRng, fragment, bookmarks, node, newBlock; var removeAndKeepBookmarks = function (targetNode) { global$5.each(bookmarks, function (node) { targetNode.parentNode.insertBefore(node, li.parentNode); }); DOM$1.remove(targetNode); }; bookmarks = DOM$1.select('span[data-mce-type="bookmark"]', ul); newBlock = createTextBlock(editor, li); tmpRng = DOM$1.createRng(); tmpRng.setStartAfter(li); tmpRng.setEndAfter(ul); fragment = tmpRng.extractContents(); for (node = fragment.firstChild; node; node = node.firstChild) { if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) { DOM$1.remove(node); break; } } if (!editor.dom.isEmpty(fragment)) { DOM$1.insertAfter(fragment, ul); } DOM$1.insertAfter(newBlock, ul); if (NodeType.isEmpty(editor.dom, li.parentNode)) { removeAndKeepBookmarks(li.parentNode); } DOM$1.remove(li); if (NodeType.isEmpty(editor.dom, ul)) { DOM$1.remove(ul); } }; var SplitList = { splitList: splitList }; var outdentDlItem = function (editor, item) { if (is$1(item, 'dd')) { mutate(item, 'dt'); } else if (is$1(item, 'dt')) { parent(item).each(function (dl) { return SplitList.splitList(editor, dl.dom(), item.dom()); }); } }; var indentDlItem = function (item) { if (is$1(item, 'dt')) { mutate(item, 'dd'); } }; var dlIndentation = function (editor, indentation, dlItems) { if (indentation === 'Indent') { each(dlItems, indentDlItem); } else { each(dlItems, function (item) { return outdentDlItem(editor, item); }); } }; var selectionIndentation = function (editor, indentation) { var lists = map(Selection.getSelectedListRoots(editor), Element.fromDom); var dlItems = map(Selection.getSelectedDlItems(editor), Element.fromDom); var isHandled = false; if (lists.length || dlItems.length) { var bookmark = editor.selection.getBookmark(); listsIndentation(editor, lists, indentation); dlIndentation(editor, indentation, dlItems); editor.selection.moveToBookmark(bookmark); editor.selection.setRng(Range.normalizeRange(editor.selection.getRng())); editor.nodeChanged(); isHandled = true; } return isHandled; }; var indentListSelection = function (editor) { return selectionIndentation(editor, 'Indent'); }; var outdentListSelection = function (editor) { return selectionIndentation(editor, 'Outdent'); }; var flattenListSelection = function (editor) { return selectionIndentation(editor, 'Flatten'); }; var updateListStyle = function (dom, el, detail) { var type = detail['list-style-type'] ? detail['list-style-type'] : null; dom.setStyle(el, 'list-style-type', type); }; var setAttribs = function (elm, attrs) { global$5.each(attrs, function (value, key) { elm.setAttribute(key, value); }); }; var updateListAttrs = function (dom, el, detail) { setAttribs(el, detail['list-attributes']); global$5.each(dom.select('li', el), function (li) { setAttribs(li, detail['list-item-attributes']); }); }; var updateListWithDetails = function (dom, el, detail) { updateListStyle(dom, el, detail); updateListAttrs(dom, el, detail); }; var removeStyles = function (dom, element, styles) { global$5.each(styles, function (style) { var _a; return dom.setStyle(element, (_a = {}, _a[style] = '', _a)); }); }; var getEndPointNode = function (editor, rng, start, root) { var container, offset; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; if (container.nodeType === 1) { container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; } if (!start && NodeType.isBr(container.nextSibling)) { container = container.nextSibling; } while (container.parentNode !== root) { if (NodeType.isTextBlock(editor, container)) { return container; } if (/^(TD|TH)$/.test(container.parentNode.nodeName)) { return container; } container = container.parentNode; } return container; }; var getSelectedTextBlocks = function (editor, rng, root) { var textBlocks = [], dom = editor.dom; var startNode = getEndPointNode(editor, rng, true, root); var endNode = getEndPointNode(editor, rng, false, root); var block; var siblings = []; for (var node = startNode; node; node = node.nextSibling) { siblings.push(node); if (node === endNode) { break; } } global$5.each(siblings, function (node) { if (NodeType.isTextBlock(editor, node)) { textBlocks.push(node); block = null; return; } if (dom.isBlock(node) || NodeType.isBr(node)) { if (NodeType.isBr(node)) { dom.remove(node); } block = null; return; } var nextSibling = node.nextSibling; if (global$4.isBookmarkNode(node)) { if (NodeType.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) { block = null; return; } } if (!block) { block = dom.create('p'); node.parentNode.insertBefore(block, node); textBlocks.push(block); } block.appendChild(node); }); return textBlocks; }; var hasCompatibleStyle = function (dom, sib, detail) { var sibStyle = dom.getStyle(sib, 'list-style-type'); var detailStyle = detail ? detail['list-style-type'] : ''; detailStyle = detailStyle === null ? '' : detailStyle; return sibStyle === detailStyle; }; var applyList = function (editor, listName, detail) { if (detail === void 0) { detail = {}; } var rng = editor.selection.getRng(true); var bookmark; var listItemName = 'LI'; var root = Selection.getClosestListRootElm(editor, editor.selection.getStart(true)); var dom = editor.dom; if (dom.getContentEditable(editor.selection.getNode()) === 'false') { return; } listName = listName.toUpperCase(); if (listName === 'DL') { listItemName = 'DT'; } bookmark = Bookmark.createBookmark(rng); global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) { var listBlock, sibling; sibling = block.previousSibling; if (sibling && NodeType.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) { listBlock = sibling; block = dom.rename(block, listItemName); sibling.appendChild(block); } else { listBlock = dom.create(listName); block.parentNode.insertBefore(listBlock, block); listBlock.appendChild(block); block = dom.rename(block, listItemName); } removeStyles(dom, block, [ 'margin', 'margin-right', 'margin-bottom', 'margin-left', 'margin-top', 'padding', 'padding-right', 'padding-bottom', 'padding-left', 'padding-top' ]); updateListWithDetails(dom, listBlock, detail); mergeWithAdjacentLists(editor.dom, listBlock); }); editor.selection.setRng(Bookmark.resolveBookmark(bookmark)); }; var isValidLists = function (list1, list2) { return list1 && list2 && NodeType.isListNode(list1) && list1.nodeName === list2.nodeName; }; var hasSameListStyle = function (dom, list1, list2) { var targetStyle = dom.getStyle(list1, 'list-style-type', true); var style = dom.getStyle(list2, 'list-style-type', true); return targetStyle === style; }; var hasSameClasses = function (elm1, elm2) { return elm1.className === elm2.className; }; var shouldMerge = function (dom, list1, list2) { return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2); }; var mergeWithAdjacentLists = function (dom, listBlock) { var sibling, node; sibling = listBlock.nextSibling; if (shouldMerge(dom, listBlock, sibling)) { while (node = sibling.firstChild) { listBlock.appendChild(node); } dom.remove(sibling); } sibling = listBlock.previousSibling; if (shouldMerge(dom, listBlock, sibling)) { while (node = sibling.lastChild) { listBlock.insertBefore(node, listBlock.firstChild); } dom.remove(sibling); } }; var updateList = function (dom, list, listName, detail) { if (list.nodeName !== listName) { var newList = dom.rename(list, listName); updateListWithDetails(dom, newList, detail); } else { updateListWithDetails(dom, list, detail); } }; var toggleMultipleLists = function (editor, parentList, lists, listName, detail) { if (parentList.nodeName === listName && !hasListStyleDetail(detail)) { flattenListSelection(editor); } else { var bookmark = Bookmark.createBookmark(editor.selection.getRng(true)); global$5.each([parentList].concat(lists), function (elm) { updateList(editor.dom, elm, listName, detail); }); editor.selection.setRng(Bookmark.resolveBookmark(bookmark)); } }; var hasListStyleDetail = function (detail) { return 'list-style-type' in detail; }; var toggleSingleList = function (editor, parentList, listName, detail) { if (parentList === editor.getBody()) { return; } if (parentList) { if (parentList.nodeName === listName && !hasListStyleDetail(detail)) { flattenListSelection(editor); } else { var bookmark = Bookmark.createBookmark(editor.selection.getRng(true)); updateListWithDetails(editor.dom, parentList, detail); mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName)); editor.selection.setRng(Bookmark.resolveBookmark(bookmark)); } } else { applyList(editor, listName, detail); } }; var toggleList = function (editor, listName, detail) { var parentList = Selection.getParentList(editor); var selectedSubLists = Selection.getSelectedSubLists(editor); detail = detail ? detail : {}; if (parentList && selectedSubLists.length > 0) { toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail); } else { toggleSingleList(editor, parentList, listName, detail); } }; var ToggleList = { toggleList: toggleList, mergeWithAdjacentLists: mergeWithAdjacentLists }; var DOM$2 = global$6.DOM; var normalizeList = function (dom, ul) { var sibling; var parentNode = ul.parentNode; if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) { sibling = parentNode.previousSibling; if (sibling && sibling.nodeName === 'LI') { sibling.appendChild(ul); if (NodeType.isEmpty(dom, parentNode)) { DOM$2.remove(parentNode); } } else { DOM$2.setStyle(parentNode, 'listStyleType', 'none'); } } if (NodeType.isListNode(parentNode)) { sibling = parentNode.previousSibling; if (sibling && sibling.nodeName === 'LI') { sibling.appendChild(ul); } } }; var normalizeLists = function (dom, element) { global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) { normalizeList(dom, ul); }); }; var NormalizeLists = { normalizeList: normalizeList, normalizeLists: normalizeLists }; var findNextCaretContainer = function (editor, rng, isForward, root) { var node = rng.startContainer; var offset = rng.startOffset; var nonEmptyBlocks, walker; if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) { return node; } nonEmptyBlocks = editor.schema.getNonEmptyElements(); if (node.nodeType === 1) { node = global$1.getNode(node, offset); } walker = new global$2(node, root); if (isForward) { if (NodeType.isBogusBr(editor.dom, node)) { walker.next(); } } while (node = walker[isForward ? 'next' : 'prev2']()) { if (node.nodeName === 'LI' && !node.hasChildNodes()) { return node; } if (nonEmptyBlocks[node.nodeName]) { return node; } if (node.nodeType === 3 && node.data.length > 0) { return node; } } }; var hasOnlyOneBlockChild = function (dom, elm) { var childNodes = elm.childNodes; return childNodes.length === 1 && !NodeType.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]); }; var unwrapSingleBlockChild = function (dom, elm) { if (hasOnlyOneBlockChild(dom, elm)) { dom.remove(elm.firstChild, true); } }; var moveChildren = function (dom, fromElm, toElm) { var node, targetElm; targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm; unwrapSingleBlockChild(dom, fromElm); if (!NodeType.isEmpty(dom, fromElm, true)) { while (node = fromElm.firstChild) { targetElm.appendChild(node); } } }; var mergeLiElements = function (dom, fromElm, toElm) { var node, listNode; var ul = fromElm.parentNode; if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) { return; } if (NodeType.isListNode(toElm.lastChild)) { listNode = toElm.lastChild; } if (ul === toElm.lastChild) { if (NodeType.isBr(ul.previousSibling)) { dom.remove(ul.previousSibling); } } node = toElm.lastChild; if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) { dom.remove(node); } if (NodeType.isEmpty(dom, toElm, true)) { dom.$(toElm).empty(); } moveChildren(dom, fromElm, toElm); if (listNode) { toElm.appendChild(listNode); } var contains = contains$1(Element.fromDom(toElm), Element.fromDom(fromElm)); var nestedLists = contains ? dom.getParents(fromElm, NodeType.isListNode, toElm) : []; dom.remove(fromElm); each(nestedLists, function (list) { if (NodeType.isEmpty(dom, list) && list !== dom.getRoot()) { dom.remove(list); } }); }; var mergeIntoEmptyLi = function (editor, fromLi, toLi) { editor.dom.$(toLi).empty(); mergeLiElements(editor.dom, fromLi, toLi); editor.selection.setCursorLocation(toLi); }; var mergeForward = function (editor, rng, fromLi, toLi) { var dom = editor.dom; if (dom.isEmpty(toLi)) { mergeIntoEmptyLi(editor, fromLi, toLi); } else { var bookmark = Bookmark.createBookmark(rng); mergeLiElements(dom, fromLi, toLi); editor.selection.setRng(Bookmark.resolveBookmark(bookmark)); } }; var mergeBackward = function (editor, rng, fromLi, toLi) { var bookmark = Bookmark.createBookmark(rng); mergeLiElements(editor.dom, fromLi, toLi); var resolvedBookmark = Bookmark.resolveBookmark(bookmark); editor.selection.setRng(resolvedBookmark); }; var backspaceDeleteFromListToListCaret = function (editor, isForward) { var dom = editor.dom, selection = editor.selection; var selectionStartElm = selection.getStart(); var root = Selection.getClosestListRootElm(editor, selectionStartElm); var li = dom.getParent(selection.getStart(), 'LI', root); var ul, rng, otherLi; if (li) { ul = li.parentNode; if (ul === editor.getBody() && NodeType.isEmpty(dom, ul)) { return true; } rng = Range.normalizeRange(selection.getRng(true)); otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root); if (otherLi && otherLi !== li) { if (isForward) { mergeForward(editor, rng, otherLi, li); } else { mergeBackward(editor, rng, li, otherLi); } return true; } else if (!otherLi) { if (!isForward) { flattenListSelection(editor); return true; } } } return false; }; var removeBlock = function (dom, block, root) { var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root); dom.remove(block); if (parentBlock && dom.isEmpty(parentBlock)) { dom.remove(parentBlock); } }; var backspaceDeleteIntoListCaret = function (editor, isForward) { var dom = editor.dom; var selectionStartElm = editor.selection.getStart(); var root = Selection.getClosestListRootElm(editor, selectionStartElm); var block = dom.getParent(selectionStartElm, dom.isBlock, root); if (block && dom.isEmpty(block)) { var rng = Range.normalizeRange(editor.selection.getRng(true)); var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root); if (otherLi_1) { editor.undoManager.transact(function () { removeBlock(dom, block, root); ToggleList.mergeWithAdjacentLists(dom, otherLi_1.parentNode); editor.selection.select(otherLi_1, true); editor.selection.collapse(isForward); }); return true; } } return false; }; var backspaceDeleteCaret = function (editor, isForward) { return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward); }; var backspaceDeleteRange = function (editor) { var selectionStartElm = editor.selection.getStart(); var root = Selection.getClosestListRootElm(editor, selectionStartElm); var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root); if (startListParent || Selection.getSelectedListItems(editor).length > 0) { editor.undoManager.transact(function () { editor.execCommand('Delete'); NormalizeLists.normalizeLists(editor.dom, editor.getBody()); }); return true; } return false; }; var backspaceDelete = function (editor, isForward) { return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor); }; var setup = function (editor) { editor.on('keydown', function (e) { if (e.keyCode === global$3.BACKSPACE) { if (backspaceDelete(editor, false)) { e.preventDefault(); } } else if (e.keyCode === global$3.DELETE) { if (backspaceDelete(editor, true)) { e.preventDefault(); } } }); }; var Delete = { setup: setup, backspaceDelete: backspaceDelete }; var get = function (editor) { return { backspaceDelete: function (isForward) { Delete.backspaceDelete(editor, isForward); } }; }; var Api = { get: get }; var queryListCommandState = function (editor, listName) { return function () { var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL'); return parentList && parentList.nodeName === listName; }; }; var register = function (editor) { editor.on('BeforeExecCommand', function (e) { var cmd = e.command.toLowerCase(); if (cmd === 'indent') { indentListSelection(editor); } else if (cmd === 'outdent') { outdentListSelection(editor); } }); editor.addCommand('InsertUnorderedList', function (ui, detail) { ToggleList.toggleList(editor, 'UL', detail); }); editor.addCommand('InsertOrderedList', function (ui, detail) { ToggleList.toggleList(editor, 'OL', detail); }); editor.addCommand('InsertDefinitionList', function (ui, detail) { ToggleList.toggleList(editor, 'DL', detail); }); editor.addCommand('RemoveList', function () { flattenListSelection(editor); }); editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL')); editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL')); editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL')); }; var Commands = { register: register }; var shouldIndentOnTab = function (editor) { return editor.getParam('lists_indent_on_tab', true); }; var Settings = { shouldIndentOnTab: shouldIndentOnTab }; var setupTabKey = function (editor) { editor.on('keydown', function (e) { if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) { return; } editor.undoManager.transact(function () { if (e.shiftKey ? outdentListSelection(editor) : indentListSelection(editor)) { e.preventDefault(); } }); }); }; var setup$1 = function (editor) { if (Settings.shouldIndentOnTab(editor)) { setupTabKey(editor); } Delete.setup(editor); }; var Keyboard = { setup: setup$1 }; var findIndex = function (list, predicate) { for (var index = 0; index < list.length; index++) { var element = list[index]; if (predicate(element)) { return index; } } return -1; }; var listState = function (editor, listName) { return function (e) { var ctrl = e.control; editor.on('NodeChange', function (e) { var tableCellIndex = findIndex(e.parents, NodeType.isTableCellNode); var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents; var lists = global$5.grep(parents, NodeType.isListNode); ctrl.active(lists.length > 0 && lists[0].nodeName === listName); }); }; }; var register$1 = function (editor) { var hasPlugin = function (editor, plugin) { var plugins = editor.settings.plugins ? editor.settings.plugins : ''; return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1; }; if (!hasPlugin(editor, 'advlist')) { editor.addButton('numlist', { active: false, title: 'Numbered list', cmd: 'InsertOrderedList', onPostRender: listState(editor, 'OL') }); editor.addButton('bullist', { active: false, title: 'Bullet list', cmd: 'InsertUnorderedList', onPostRender: listState(editor, 'UL') }); } editor.addButton('indent', { icon: 'indent', title: 'Increase indent', cmd: 'Indent' }); }; var Buttons = { register: register$1 }; global.add('lists', function (editor) { Keyboard.setup(editor); Buttons.register(editor); Commands.register(editor); return Api.get(editor); }); function Plugin () { } return Plugin; }(window)); })(); lists/plugin.min.js000064400000064530147331520370010335 0ustar00!function(u){"use strict";var e,n,t,r,o,i,s,a,c,f=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),l=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),m=tinymce.util.Tools.resolve("tinymce.util.VK"),p=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),h=function(e){return e&&"BR"===e.nodeName},y=function(e){return e&&3===e.nodeType},N=function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)},S=function(e){return e&&/^(OL|UL)$/.test(e.nodeName)},C=function(e){return e&&/^(DT|DD)$/.test(e.nodeName)},O=function(e){return e&&/^(LI|DT|DD)$/.test(e.nodeName)},b=function(e){return e&&/^(TH|TD)$/.test(e.nodeName)},T=h,E=function(e,n){return n&&!!e.schema.getTextBlockElements()[n.nodeName]},L=function(e,n){return e&&e.nodeName in n},D=function(e,n){return!!h(n)&&!(!e.isBlock(n.nextSibling)||h(n.previousSibling))},w=function(e,n,t){var r=e.isEmpty(n);return!(t&&0=e.childNodes.length?t.data.length:0}:t.previousSibling&&y(t.previousSibling)?{container:t.previousSibling,offset:t.previousSibling.data.length}:t.nextSibling&&y(t.nextSibling)?{container:t.nextSibling,offset:0}:{container:e,offset:n}},x=function(e){var n=e.cloneRange(),t=A(e.startContainer,e.startOffset);n.setStart(t.container,t.offset);var r=A(e.endContainer,e.endOffset);return n.setEnd(r.container,r.offset),n},R=g.DOM,I=function(o){var i={},e=function(e){var n,t,r;t=o[e?"startContainer":"endContainer"],r=o[e?"startOffset":"endOffset"],1===t.nodeType&&(n=R.create("span",{"data-mce-type":"bookmark"}),t.hasChildNodes()?(r=Math.min(r,t.childNodes.length-1),e?t.insertBefore(n,t.childNodes[r]):R.insertAfter(n,t.childNodes[r])):t.appendChild(n),t=n,r=0),i[e?"startContainer":"endContainer"]=t,i[e?"startOffset":"endOffset"]=r};return e(!0),o.collapsed||e(),i},_=function(o){function e(e){var n,t,r;n=r=o[e?"startContainer":"endContainer"],t=o[e?"startOffset":"endOffset"],n&&(1===n.nodeType&&(t=function(e){for(var n=e.parentNode.firstChild,t=0;n;){if(n===e)return t;1===n.nodeType&&"bookmark"===n.getAttribute("data-mce-type")||t++,n=n.nextSibling}return-1}(n),n=n.parentNode,R.remove(r),!n.hasChildNodes()&&R.isBlock(n)&&n.appendChild(R.create("br"))),o[e?"startContainer":"endContainer"]=n,o[e?"startOffset":"endOffset"]=t)}e(!0),e();var n=R.createRng();return n.setStart(o.startContainer,o.startOffset),o.endContainer&&n.setEnd(o.endContainer,o.endOffset),x(n)},B=function(){},P=function(e){return function(){return e}},M=function(t){return function(){for(var e=[],n=0;ne.length?Sn(t,e,n):Nn(t,e,n)},[]),oe(o).map(function(e){return e.list})).toArray();var t,r,o},Pn=function(e){var n,t,r=J(ve.getSelectedListItems(e),ye.fromDom);return Ne(te(r,M(On)),te((n=r,(t=Y.call(n,0)).reverse(),t),M(On)),function(e,n){return{start:e,end:n}})},Mn=function(s,e,a){var n,t,r,o=(n=e,t=Pn(s),r=kn(!1),J(n,function(e){return{sourceList:e,entries:xn(0,t,r,e)}}));Z(o,function(e){var n,t,r,o,i,u;n=e.entries,t=a,Z(ee(n,Tn),function(e){return function(e,n){switch(e){case"Indent":n.depth++;break;case"Outdent":n.depth--;break;case"Flatten":n.depth=0}}(t,e)}),r=e.sourceList,i=s,u=e.entries,o=re(function(e,n){if(0===e.length)return[];for(var t=n(e[0]),r=[],o=[],i=0,u=e.length;i -1, isWin8 = ( function() { var match = ua.match( /Windows NT 6\.(\d)/ ); if ( match && match[1] > 1 ) { return true; } return false; }()); if ( ! wp || ! wp.emoji || settings.supports.everything ) { return; } function setImgAttr( image ) { image.className = 'emoji'; image.setAttribute( 'data-mce-resize', 'false' ); image.setAttribute( 'data-mce-placeholder', '1' ); image.setAttribute( 'data-wp-emoji', '1' ); } function replaceEmoji( node ) { var imgAttr = { 'data-mce-resize': 'false', 'data-mce-placeholder': '1', 'data-wp-emoji': '1' }; wp.emoji.parse( node, { imgAttr: imgAttr } ); } // Test if the node text contains emoji char(s) and replace. function parseNode( node ) { var selection, bookmark; if ( node && window.twemoji && window.twemoji.test( node.textContent || node.innerText ) ) { if ( env.webkit ) { selection = editor.selection; bookmark = selection.getBookmark(); } replaceEmoji( node ); if ( env.webkit ) { selection.moveToBookmark( bookmark ); } } } if ( isWin8 ) { /* * Windows 8+ emoji can be "typed" with the onscreen keyboard. * That triggers the normal keyboard events, but not the 'input' event. * Thankfully it sets keyCode 231 when the onscreen keyboard inserts any emoji. */ editor.on( 'keyup', function( event ) { if ( event.keyCode === 231 ) { parseNode( editor.selection.getNode() ); } } ); } else if ( ! isWin ) { /* * In MacOS inserting emoji doesn't trigger the stanradr keyboard events. * Thankfully it triggers the 'input' event. * This works in Android and iOS as well. */ editor.on( 'keydown keyup', function( event ) { typing = ( event.type === 'keydown' ); } ); editor.on( 'input', function() { if ( typing ) { return; } parseNode( editor.selection.getNode() ); }); } editor.on( 'setcontent', function( event ) { var selection = editor.selection, node = selection.getNode(); if ( window.twemoji && window.twemoji.test( node.textContent || node.innerText ) ) { replaceEmoji( node ); // In IE all content in the editor is left selected after wp.emoji.parse()... // Collapse the selection to the beginning. if ( env.ie && env.ie < 9 && event.load && node && node.nodeName === 'BODY' ) { selection.collapse( true ); } } } ); // Convert Twemoji compatible pasted emoji replacement images into our format. editor.on( 'PastePostProcess', function( event ) { if ( window.twemoji ) { tinymce.each( editor.dom.$( 'img.emoji', event.node ), function( image ) { if ( image.alt && window.twemoji.test( image.alt ) ) { setImgAttr( image ); } }); } }); editor.on( 'postprocess', function( event ) { if ( event.content ) { event.content = event.content.replace( /]+data-wp-emoji="[^>]+>/g, function( img ) { var alt = img.match( /alt="([^"]+)"/ ); if ( alt && alt[1] ) { return alt[1]; } return img; }); } } ); editor.on( 'resolvename', function( event ) { if ( event.target.nodeName === 'IMG' && editor.dom.getAttrib( event.target, 'data-wp-emoji' ) ) { event.preventDefault(); } } ); } ); } )( window.tinymce ); wpemoji/plugin.min.js000064400000002757147331520370010654 0ustar00!function(m){m.PluginManager.add("wpemoji",function(n){var t,o=window.wp,e=window._wpemojiSettings,i=m.Env,a=window.navigator.userAgent,w=-1]+data-wp-emoji="[^>]+>/g,function(e){var t=e.match(/alt="([^"]+)"/);return t&&t[1]?t[1]:e}))}),n.on("resolvename",function(e){"IMG"===e.target.nodeName&&n.dom.getAttrib(e.target,"data-wp-emoji")&&e.preventDefault()}))})}(window.tinymce);fullscreen/plugin.js000064400000012733147331520370010555 0ustar00(function () { var fullscreen = (function (domGlobals) { 'use strict'; var Cell = function (initial) { var value = initial; var get = function () { return value; }; var set = function (v) { value = v; }; var clone = function () { return Cell(get()); }; return { get: get, set: set, clone: clone }; }; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var get = function (fullscreenState) { return { isFullscreen: function () { return fullscreenState.get() !== null; } }; }; var Api = { get: get }; var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); var fireFullscreenStateChanged = function (editor, state) { editor.fire('FullscreenStateChanged', { state: state }); }; var Events = { fireFullscreenStateChanged: fireFullscreenStateChanged }; var DOM = global$1.DOM; var getWindowSize = function () { var w; var h; var win = domGlobals.window; var doc = domGlobals.document; var body = doc.body; if (body.offsetWidth) { w = body.offsetWidth; h = body.offsetHeight; } if (win.innerWidth && win.innerHeight) { w = win.innerWidth; h = win.innerHeight; } return { w: w, h: h }; }; var getScrollPos = function () { var vp = DOM.getViewPort(); return { x: vp.x, y: vp.y }; }; var setScrollPos = function (pos) { domGlobals.window.scrollTo(pos.x, pos.y); }; var toggleFullscreen = function (editor, fullscreenState) { var body = domGlobals.document.body; var documentElement = domGlobals.document.documentElement; var editorContainerStyle; var editorContainer, iframe, iframeStyle; var fullscreenInfo = fullscreenState.get(); var resize = function () { DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight)); }; var removeResize = function () { DOM.unbind(domGlobals.window, 'resize', resize); }; editorContainer = editor.getContainer(); editorContainerStyle = editorContainer.style; iframe = editor.getContentAreaContainer().firstChild; iframeStyle = iframe.style; if (!fullscreenInfo) { var newFullScreenInfo = { scrollPos: getScrollPos(), containerWidth: editorContainerStyle.width, containerHeight: editorContainerStyle.height, iframeWidth: iframeStyle.width, iframeHeight: iframeStyle.height, resizeHandler: resize, removeHandler: removeResize }; iframeStyle.width = iframeStyle.height = '100%'; editorContainerStyle.width = editorContainerStyle.height = ''; DOM.addClass(body, 'mce-fullscreen'); DOM.addClass(documentElement, 'mce-fullscreen'); DOM.addClass(editorContainer, 'mce-fullscreen'); DOM.bind(domGlobals.window, 'resize', resize); editor.on('remove', removeResize); resize(); fullscreenState.set(newFullScreenInfo); Events.fireFullscreenStateChanged(editor, true); } else { iframeStyle.width = fullscreenInfo.iframeWidth; iframeStyle.height = fullscreenInfo.iframeHeight; if (fullscreenInfo.containerWidth) { editorContainerStyle.width = fullscreenInfo.containerWidth; } if (fullscreenInfo.containerHeight) { editorContainerStyle.height = fullscreenInfo.containerHeight; } DOM.removeClass(body, 'mce-fullscreen'); DOM.removeClass(documentElement, 'mce-fullscreen'); DOM.removeClass(editorContainer, 'mce-fullscreen'); setScrollPos(fullscreenInfo.scrollPos); DOM.unbind(domGlobals.window, 'resize', fullscreenInfo.resizeHandler); editor.off('remove', fullscreenInfo.removeHandler); fullscreenState.set(null); Events.fireFullscreenStateChanged(editor, false); } }; var Actions = { toggleFullscreen: toggleFullscreen }; var register = function (editor, fullscreenState) { editor.addCommand('mceFullScreen', function () { Actions.toggleFullscreen(editor, fullscreenState); }); }; var Commands = { register: register }; var postRender = function (editor) { return function (e) { var ctrl = e.control; editor.on('FullscreenStateChanged', function (e) { ctrl.active(e.state); }); }; }; var register$1 = function (editor) { editor.addMenuItem('fullscreen', { text: 'Fullscreen', shortcut: 'Ctrl+Shift+F', selectable: true, cmd: 'mceFullScreen', onPostRender: postRender(editor), context: 'view' }); editor.addButton('fullscreen', { active: false, tooltip: 'Fullscreen', cmd: 'mceFullScreen', onPostRender: postRender(editor) }); }; var Buttons = { register: register$1 }; global.add('fullscreen', function (editor) { var fullscreenState = Cell(null); if (editor.settings.inline) { return Api.get(fullscreenState); } Commands.register(editor, fullscreenState); Buttons.register(editor); editor.addShortcut('Ctrl+Shift+F', '', 'mceFullScreen'); return Api.get(fullscreenState); }); function Plugin () { } return Plugin; }(window)); })(); fullscreen/plugin.min.js000064400000004210147331520370011326 0ustar00!function(m){"use strict";var i=function(e){var n=e,t=function(){return n};return{get:t,set:function(e){n=e},clone:function(){return i(t())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return{isFullscreen:function(){return null!==e.get()}}},n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=function(e,n){e.fire("FullscreenStateChanged",{state:n})},w=n.DOM,r=function(e,n){var t,r,l,i,o,c,s=m.document.body,u=m.document.documentElement,d=n.get(),a=function(){var e,n,t,i;w.setStyle(l,"height",(t=m.window,i=m.document.body,i.offsetWidth&&(e=i.offsetWidth,n=i.offsetHeight),t.innerWidth&&t.innerHeight&&(e=t.innerWidth,n=t.innerHeight),{w:e,h:n}).h-(r.clientHeight-l.clientHeight))},h=function(){w.unbind(m.window,"resize",a)};if(t=(r=e.getContainer()).style,i=(l=e.getContentAreaContainer().firstChild).style,d)i.width=d.iframeWidth,i.height=d.iframeHeight,d.containerWidth&&(t.width=d.containerWidth),d.containerHeight&&(t.height=d.containerHeight),w.removeClass(s,"mce-fullscreen"),w.removeClass(u,"mce-fullscreen"),w.removeClass(r,"mce-fullscreen"),o=d.scrollPos,m.window.scrollTo(o.x,o.y),w.unbind(m.window,"resize",d.resizeHandler),e.off("remove",d.removeHandler),n.set(null),g(e,!1);else{var f={scrollPos:(c=w.getViewPort(),{x:c.x,y:c.y}),containerWidth:t.width,containerHeight:t.height,iframeWidth:i.width,iframeHeight:i.height,resizeHandler:a,removeHandler:h};i.width=i.height="100%",t.width=t.height="",w.addClass(s,"mce-fullscreen"),w.addClass(u,"mce-fullscreen"),w.addClass(r,"mce-fullscreen"),w.bind(m.window,"resize",a),e.on("remove",h),a(),n.set(f),g(e,!0)}},l=function(e,n){e.addCommand("mceFullScreen",function(){r(e,n)})},o=function(t){return function(e){var n=e.control;t.on("FullscreenStateChanged",function(e){n.active(e.state)})}},c=function(e){e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,cmd:"mceFullScreen",onPostRender:o(e),context:"view"}),e.addButton("fullscreen",{active:!1,tooltip:"Fullscreen",cmd:"mceFullScreen",onPostRender:o(e)})};e.add("fullscreen",function(e){var n=i(null);return e.settings.inline||(l(e,n),c(e),e.addShortcut("Ctrl+Shift+F","","mceFullScreen")),t(n)})}(window);wpgallery/plugin.js000064400000006157147331520370010424 0ustar00/* global tinymce */ tinymce.PluginManager.add('wpgallery', function( editor ) { function replaceGalleryShortcodes( content ) { return content.replace( /\[gallery([^\]]*)\]/g, function( match ) { return html( 'wp-gallery', match ); }); } function html( cls, data ) { data = window.encodeURIComponent( data ); return ''; } function restoreMediaShortcodes( content ) { function getAttr( str, name ) { name = new RegExp( name + '=\"([^\"]+)\"' ).exec( str ); return name ? window.decodeURIComponent( name[1] ) : ''; } return content.replace( /(?:]+)?>)*(]+>)(?:<\/p>)*/g, function( match, image ) { var data = getAttr( image, 'data-wp-media' ); if ( data ) { return '

' + data + '

'; } return match; }); } function editMedia( node ) { var gallery, frame, data; if ( node.nodeName !== 'IMG' ) { return; } // Check if the `wp.media` API exists. if ( typeof wp === 'undefined' || ! wp.media ) { return; } data = window.decodeURIComponent( editor.dom.getAttrib( node, 'data-wp-media' ) ); // Make sure we've selected a gallery node. if ( editor.dom.hasClass( node, 'wp-gallery' ) && wp.media.gallery ) { gallery = wp.media.gallery; frame = gallery.edit( data ); frame.state('gallery-edit').on( 'update', function( selection ) { var shortcode = gallery.shortcode( selection ).string(); editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); frame.detach(); }); } } // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...'). editor.addCommand( 'WP_Gallery', function() { editMedia( editor.selection.getNode() ); }); editor.on( 'mouseup', function( event ) { var dom = editor.dom, node = event.target; function unselect() { dom.removeClass( dom.select( 'img.wp-media-selected' ), 'wp-media-selected' ); } if ( node.nodeName === 'IMG' && dom.getAttrib( node, 'data-wp-media' ) ) { // Don't trigger on right-click. if ( event.button !== 2 ) { if ( dom.hasClass( node, 'wp-media-selected' ) ) { editMedia( node ); } else { unselect(); dom.addClass( node, 'wp-media-selected' ); } } } else { unselect(); } }); // Display gallery, audio or video instead of img in the element path. editor.on( 'ResolveName', function( event ) { var dom = editor.dom, node = event.target; if ( node.nodeName === 'IMG' && dom.getAttrib( node, 'data-wp-media' ) ) { if ( dom.hasClass( node, 'wp-gallery' ) ) { event.name = 'gallery'; } } }); editor.on( 'BeforeSetContent', function( event ) { // 'wpview' handles the gallery shortcode when present. if ( ! editor.plugins.wpview || typeof wp === 'undefined' || ! wp.mce ) { event.content = replaceGalleryShortcodes( event.content ); } }); editor.on( 'PostProcess', function( event ) { if ( event.get ) { event.content = restoreMediaShortcodes( event.content ); } }); }); wpgallery/plugin.min.js000064400000003127147331520370011200 0ustar00tinymce.PluginManager.add("wpgallery",function(d){function t(e){return e.replace(/\[gallery([^\]]*)\]/g,function(e){return t="wp-gallery",n=e,n=window.encodeURIComponent(e),'';var t,n})}function n(e){return e.replace(/(?:]+)?>)*(]+>)(?:<\/p>)*/g,function(e,t){t=t,n="data-wp-media";var n,t=(n=new RegExp(n+'="([^"]+)"').exec(t))?window.decodeURIComponent(n[1]):"";return t?"

"+t+"

":e})}function o(t){var n,a,e;"IMG"===t.nodeName&&"undefined"!=typeof wp&&wp.media&&(e=window.decodeURIComponent(d.dom.getAttrib(t,"data-wp-media")),d.dom.hasClass(t,"wp-gallery"))&&wp.media.gallery&&(n=wp.media.gallery,(a=n.edit(e)).state("gallery-edit").on("update",function(e){e=n.shortcode(e).string();d.dom.setAttrib(t,"data-wp-media",window.encodeURIComponent(e)),a.detach()}))}d.addCommand("WP_Gallery",function(){o(d.selection.getNode())}),d.on("mouseup",function(e){var t=d.dom,n=e.target;function a(){t.removeClass(t.select("img.wp-media-selected"),"wp-media-selected")}"IMG"===n.nodeName&&t.getAttrib(n,"data-wp-media")?2!==e.button&&(t.hasClass(n,"wp-media-selected")?o(n):(a(),t.addClass(n,"wp-media-selected"))):a()}),d.on("ResolveName",function(e){var t=d.dom,n=e.target;"IMG"===n.nodeName&&t.getAttrib(n,"data-wp-media")&&t.hasClass(n,"wp-gallery")&&(e.name="gallery")}),d.on("BeforeSetContent",function(e){d.plugins.wpview&&"undefined"!=typeof wp&&wp.mce||(e.content=t(e.content))}),d.on("PostProcess",function(e){e.get&&(e.content=n(e.content))})});media/plugin.js000064400000120572147331520370007473 0ustar00(function () { var media = (function () { 'use strict'; var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); var global$1 = tinymce.util.Tools.resolve('tinymce.Env'); var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools'); var getScripts = function (editor) { return editor.getParam('media_scripts'); }; var getAudioTemplateCallback = function (editor) { return editor.getParam('audio_template_callback'); }; var getVideoTemplateCallback = function (editor) { return editor.getParam('video_template_callback'); }; var hasLiveEmbeds = function (editor) { return editor.getParam('media_live_embeds', true); }; var shouldFilterHtml = function (editor) { return editor.getParam('media_filter_html', true); }; var getUrlResolver = function (editor) { return editor.getParam('media_url_resolver'); }; var hasAltSource = function (editor) { return editor.getParam('media_alt_source', true); }; var hasPoster = function (editor) { return editor.getParam('media_poster', true); }; var hasDimensions = function (editor) { return editor.getParam('media_dimensions', true); }; var Settings = { getScripts: getScripts, getAudioTemplateCallback: getAudioTemplateCallback, getVideoTemplateCallback: getVideoTemplateCallback, hasLiveEmbeds: hasLiveEmbeds, shouldFilterHtml: shouldFilterHtml, getUrlResolver: getUrlResolver, hasAltSource: hasAltSource, hasPoster: hasPoster, hasDimensions: hasDimensions }; var Cell = function (initial) { var value = initial; var get = function () { return value; }; var set = function (v) { value = v; }; var clone = function () { return Cell(get()); }; return { get: get, set: set, clone: clone }; }; var noop = function () { }; var constant = function (value) { return function () { return value; }; }; var never = constant(false); var always = constant(true); var none = function () { return NONE; }; var NONE = function () { var eq = function (o) { return o.isNone(); }; var call = function (thunk) { return thunk(); }; var id = function (n) { return n; }; var me = { fold: function (n, s) { return n(); }, is: never, isSome: never, isNone: always, getOr: id, getOrThunk: call, getOrDie: function (msg) { throw new Error(msg || 'error: getOrDie called on none.'); }, getOrNull: constant(null), getOrUndefined: constant(undefined), or: id, orThunk: call, map: none, each: noop, bind: none, exists: never, forall: always, filter: none, equals: eq, equals_: eq, toArray: function () { return []; }, toString: constant('none()') }; if (Object.freeze) { Object.freeze(me); } return me; }(); var some = function (a) { var constant_a = constant(a); var self = function () { return me; }; var bind = function (f) { return f(a); }; var me = { fold: function (n, s) { return s(a); }, is: function (v) { return a === v; }, isSome: always, isNone: never, getOr: constant_a, getOrThunk: constant_a, getOrDie: constant_a, getOrNull: constant_a, getOrUndefined: constant_a, or: self, orThunk: self, map: function (f) { return some(f(a)); }, each: function (f) { f(a); }, bind: bind, exists: bind, forall: bind, filter: function (f) { return f(a) ? me : NONE; }, toArray: function () { return [a]; }, toString: function () { return 'some(' + a + ')'; }, equals: function (o) { return o.is(a); }, equals_: function (o, elementEq) { return o.fold(never, function (b) { return elementEq(a, b); }); } }; return me; }; var from = function (value) { return value === null || value === undefined ? NONE : some(value); }; var Option = { some: some, none: none, from: from }; var hasOwnProperty = Object.hasOwnProperty; var get = function (obj, key) { return has(obj, key) ? Option.from(obj[key]) : Option.none(); }; var has = function (obj, key) { return hasOwnProperty.call(obj, key); }; var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); var global$4 = tinymce.util.Tools.resolve('tinymce.html.SaxParser'); var getVideoScriptMatch = function (prefixes, src) { if (prefixes) { for (var i = 0; i < prefixes.length; i++) { if (src.indexOf(prefixes[i].filter) !== -1) { return prefixes[i]; } } } }; var VideoScript = { getVideoScriptMatch: getVideoScriptMatch }; var DOM = global$3.DOM; var trimPx = function (value) { return value.replace(/px$/, ''); }; var getEphoxEmbedData = function (attrs) { var style = attrs.map.style; var styles = style ? DOM.parseStyle(style) : {}; return { type: 'ephox-embed-iri', source1: attrs.map['data-ephox-embed-iri'], source2: '', poster: '', width: get(styles, 'max-width').map(trimPx).getOr(''), height: get(styles, 'max-height').map(trimPx).getOr('') }; }; var htmlToData = function (prefixes, html) { var isEphoxEmbed = Cell(false); var data = {}; global$4({ validate: false, allow_conditional_comments: true, special: 'script,noscript', start: function (name, attrs) { if (isEphoxEmbed.get()) ; else if (has(attrs.map, 'data-ephox-embed-iri')) { isEphoxEmbed.set(true); data = getEphoxEmbedData(attrs); } else { if (!data.source1 && name === 'param') { data.source1 = attrs.map.movie; } if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') { if (!data.type) { data.type = name; } data = global$2.extend(attrs.map, data); } if (name === 'script') { var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src); if (!videoScript) { return; } data = { type: 'script', source1: attrs.map.src, width: videoScript.width, height: videoScript.height }; } if (name === 'source') { if (!data.source1) { data.source1 = attrs.map.src; } else if (!data.source2) { data.source2 = attrs.map.src; } } if (name === 'img' && !data.poster) { data.poster = attrs.map.src; } } } }).parse(html); data.source1 = data.source1 || data.src || data.data; data.source2 = data.source2 || ''; data.poster = data.poster || ''; return data; }; var HtmlToData = { htmlToData: htmlToData }; var global$5 = tinymce.util.Tools.resolve('tinymce.util.Promise'); var guess = function (url) { var mimes = { mp3: 'audio/mpeg', wav: 'audio/wav', mp4: 'video/mp4', webm: 'video/webm', ogg: 'video/ogg', swf: 'application/x-shockwave-flash' }; var fileEnd = url.toLowerCase().split('.').pop(); var mime = mimes[fileEnd]; return mime ? mime : ''; }; var Mime = { guess: guess }; var global$6 = tinymce.util.Tools.resolve('tinymce.html.Schema'); var global$7 = tinymce.util.Tools.resolve('tinymce.html.Writer'); var DOM$1 = global$3.DOM; var addPx = function (value) { return /^[0-9.]+$/.test(value) ? value + 'px' : value; }; var setAttributes = function (attrs, updatedAttrs) { for (var name in updatedAttrs) { var value = '' + updatedAttrs[name]; if (attrs.map[name]) { var i = attrs.length; while (i--) { var attr = attrs[i]; if (attr.name === name) { if (value) { attrs.map[name] = value; attr.value = value; } else { delete attrs.map[name]; attrs.splice(i, 1); } } } } else if (value) { attrs.push({ name: name, value: value }); attrs.map[name] = value; } } }; var updateEphoxEmbed = function (data, attrs) { var style = attrs.map.style; var styleMap = style ? DOM$1.parseStyle(style) : {}; styleMap['max-width'] = addPx(data.width); styleMap['max-height'] = addPx(data.height); setAttributes(attrs, { style: DOM$1.serializeStyle(styleMap) }); }; var updateHtml = function (html, data, updateAll) { var writer = global$7(); var isEphoxEmbed = Cell(false); var sourceCount = 0; var hasImage; global$4({ validate: false, allow_conditional_comments: true, special: 'script,noscript', comment: function (text) { writer.comment(text); }, cdata: function (text) { writer.cdata(text); }, text: function (text, raw) { writer.text(text, raw); }, start: function (name, attrs, empty) { if (isEphoxEmbed.get()) ; else if (has(attrs.map, 'data-ephox-embed-iri')) { isEphoxEmbed.set(true); updateEphoxEmbed(data, attrs); } else { switch (name) { case 'video': case 'object': case 'embed': case 'img': case 'iframe': if (data.height !== undefined && data.width !== undefined) { setAttributes(attrs, { width: data.width, height: data.height }); } break; } if (updateAll) { switch (name) { case 'video': setAttributes(attrs, { poster: data.poster, src: '' }); if (data.source2) { setAttributes(attrs, { src: '' }); } break; case 'iframe': setAttributes(attrs, { src: data.source1 }); break; case 'source': sourceCount++; if (sourceCount <= 2) { setAttributes(attrs, { src: data['source' + sourceCount], type: data['source' + sourceCount + 'mime'] }); if (!data['source' + sourceCount]) { return; } } break; case 'img': if (!data.poster) { return; } hasImage = true; break; } } } writer.start(name, attrs, empty); }, end: function (name) { if (!isEphoxEmbed.get()) { if (name === 'video' && updateAll) { for (var index = 1; index <= 2; index++) { if (data['source' + index]) { var attrs = []; attrs.map = {}; if (sourceCount < index) { setAttributes(attrs, { src: data['source' + index], type: data['source' + index + 'mime'] }); writer.start('source', attrs, true); } } } } if (data.poster && name === 'object' && updateAll && !hasImage) { var imgAttrs = []; imgAttrs.map = {}; setAttributes(imgAttrs, { src: data.poster, width: data.width, height: data.height }); writer.start('img', imgAttrs, true); } } writer.end(name); } }, global$6({})).parse(html); return writer.getContent(); }; var UpdateHtml = { updateHtml: updateHtml }; var urlPatterns = [ { regex: /youtu\.be\/([\w\-_\?&=.]+)/i, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$1', allowFullscreen: true }, { regex: /youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$2?$4', allowFullscreen: true }, { regex: /youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$1', allowFullscreen: true }, { regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc', allowFullscreen: true }, { regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: '//player.vimeo.com/video/$2?title=0&byline=0', allowFullscreen: true }, { regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: '//maps.google.com/maps/ms?msid=$2&output=embed"', allowFullscreen: false }, { regex: /dailymotion\.com\/video\/([^_]+)/, type: 'iframe', w: 480, h: 270, url: '//www.dailymotion.com/embed/video/$1', allowFullscreen: true }, { regex: /dai\.ly\/([^_]+)/, type: 'iframe', w: 480, h: 270, url: '//www.dailymotion.com/embed/video/$1', allowFullscreen: true } ]; var getUrl = function (pattern, url) { var match = pattern.regex.exec(url); var newUrl = pattern.url; var _loop_1 = function (i) { newUrl = newUrl.replace('$' + i, function () { return match[i] ? match[i] : ''; }); }; for (var i = 0; i < match.length; i++) { _loop_1(i); } return newUrl.replace(/\?$/, ''); }; var matchPattern = function (url) { var pattern = urlPatterns.filter(function (pattern) { return pattern.regex.test(url); }); if (pattern.length > 0) { return global$2.extend({}, pattern[0], { url: getUrl(pattern[0], url) }); } else { return null; } }; var getIframeHtml = function (data) { var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : ''; return ''; }; var getFlashHtml = function (data) { var html = ''; if (data.poster) { html += ''; } html += ''; return html; }; var getAudioHtml = function (data, audioTemplateCallback) { if (audioTemplateCallback) { return audioTemplateCallback(data); } else { return ''; } }; var getVideoHtml = function (data, videoTemplateCallback) { if (videoTemplateCallback) { return videoTemplateCallback(data); } else { return ''; } }; var getScriptHtml = function (data) { return ''; }; var dataToHtml = function (editor, dataIn) { var data = global$2.extend({}, dataIn); if (!data.source1) { global$2.extend(data, HtmlToData.htmlToData(Settings.getScripts(editor), data.embed)); if (!data.source1) { return ''; } } if (!data.source2) { data.source2 = ''; } if (!data.poster) { data.poster = ''; } data.source1 = editor.convertURL(data.source1, 'source'); data.source2 = editor.convertURL(data.source2, 'source'); data.source1mime = Mime.guess(data.source1); data.source2mime = Mime.guess(data.source2); data.poster = editor.convertURL(data.poster, 'poster'); var pattern = matchPattern(data.source1); if (pattern) { data.source1 = pattern.url; data.type = pattern.type; data.allowFullscreen = pattern.allowFullscreen; data.width = data.width || pattern.w; data.height = data.height || pattern.h; } if (data.embed) { return UpdateHtml.updateHtml(data.embed, data, true); } else { var videoScript = VideoScript.getVideoScriptMatch(Settings.getScripts(editor), data.source1); if (videoScript) { data.type = 'script'; data.width = videoScript.width; data.height = videoScript.height; } var audioTemplateCallback = Settings.getAudioTemplateCallback(editor); var videoTemplateCallback = Settings.getVideoTemplateCallback(editor); data.width = data.width || 300; data.height = data.height || 150; global$2.each(data, function (value, key) { data[key] = editor.dom.encode(value); }); if (data.type === 'iframe') { return getIframeHtml(data); } else if (data.source1mime === 'application/x-shockwave-flash') { return getFlashHtml(data); } else if (data.source1mime.indexOf('audio') !== -1) { return getAudioHtml(data, audioTemplateCallback); } else if (data.type === 'script') { return getScriptHtml(data); } else { return getVideoHtml(data, videoTemplateCallback); } } }; var DataToHtml = { dataToHtml: dataToHtml }; var cache = {}; var embedPromise = function (data, dataToHtml, handler) { return new global$5(function (res, rej) { var wrappedResolve = function (response) { if (response.html) { cache[data.source1] = response; } return res({ url: data.source1, html: response.html ? response.html : dataToHtml(data) }); }; if (cache[data.source1]) { wrappedResolve(cache[data.source1]); } else { handler({ url: data.source1 }, wrappedResolve, rej); } }); }; var defaultPromise = function (data, dataToHtml) { return new global$5(function (res) { res({ html: dataToHtml(data), url: data.source1 }); }); }; var loadedData = function (editor) { return function (data) { return DataToHtml.dataToHtml(editor, data); }; }; var getEmbedHtml = function (editor, data) { var embedHandler = Settings.getUrlResolver(editor); return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor)); }; var isCached = function (url) { return cache.hasOwnProperty(url); }; var Service = { getEmbedHtml: getEmbedHtml, isCached: isCached }; var trimPx$1 = function (value) { return value.replace(/px$/, ''); }; var addPx$1 = function (value) { return /^[0-9.]+$/.test(value) ? value + 'px' : value; }; var getSize = function (name) { return function (elm) { return elm ? trimPx$1(elm.style[name]) : ''; }; }; var setSize = function (name) { return function (elm, value) { if (elm) { elm.style[name] = addPx$1(value); } }; }; var Size = { getMaxWidth: getSize('maxWidth'), getMaxHeight: getSize('maxHeight'), setMaxWidth: setSize('maxWidth'), setMaxHeight: setSize('maxHeight') }; var doSyncSize = function (widthCtrl, heightCtrl) { widthCtrl.state.set('oldVal', widthCtrl.value()); heightCtrl.state.set('oldVal', heightCtrl.value()); }; var doSizeControls = function (win, f) { var widthCtrl = win.find('#width')[0]; var heightCtrl = win.find('#height')[0]; var constrained = win.find('#constrain')[0]; if (widthCtrl && heightCtrl && constrained) { f(widthCtrl, heightCtrl, constrained.checked()); } }; var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) { var oldWidth = widthCtrl.state.get('oldVal'); var oldHeight = heightCtrl.state.get('oldVal'); var newWidth = widthCtrl.value(); var newHeight = heightCtrl.value(); if (isContrained && oldWidth && oldHeight && newWidth && newHeight) { if (newWidth !== oldWidth) { newHeight = Math.round(newWidth / oldWidth * newHeight); if (!isNaN(newHeight)) { heightCtrl.value(newHeight); } } else { newWidth = Math.round(newHeight / oldHeight * newWidth); if (!isNaN(newWidth)) { widthCtrl.value(newWidth); } } } doSyncSize(widthCtrl, heightCtrl); }; var syncSize = function (win) { doSizeControls(win, doSyncSize); }; var updateSize = function (win) { doSizeControls(win, doUpdateSize); }; var createUi = function (onChange) { var recalcSize = function () { onChange(function (win) { updateSize(win); }); }; return { type: 'container', label: 'Dimensions', layout: 'flex', align: 'center', spacing: 5, items: [ { name: 'width', type: 'textbox', maxLength: 5, size: 5, onchange: recalcSize, ariaLabel: 'Width' }, { type: 'label', text: 'x' }, { name: 'height', type: 'textbox', maxLength: 5, size: 5, onchange: recalcSize, ariaLabel: 'Height' }, { name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' } ] }; }; var SizeManager = { createUi: createUi, syncSize: syncSize, updateSize: updateSize }; var embedChange = global$1.ie && global$1.ie <= 8 ? 'onChange' : 'onInput'; var handleError = function (editor) { return function (error) { var errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.'; editor.notificationManager.open({ type: 'error', text: errorMessage }); }; }; var getData = function (editor) { var element = editor.selection.getNode(); var dataEmbed = element.getAttribute('data-ephox-embed-iri'); if (dataEmbed) { return { 'source1': dataEmbed, 'data-ephox-embed-iri': dataEmbed, 'width': Size.getMaxWidth(element), 'height': Size.getMaxHeight(element) }; } return element.getAttribute('data-mce-object') ? HtmlToData.htmlToData(Settings.getScripts(editor), editor.serializer.serialize(element, { selection: true })) : {}; }; var getSource = function (editor) { var elm = editor.selection.getNode(); if (elm.getAttribute('data-mce-object') || elm.getAttribute('data-ephox-embed-iri')) { return editor.selection.getContent(); } }; var addEmbedHtml = function (win, editor) { return function (response) { var html = response.html; var embed = win.find('#embed')[0]; var data = global$2.extend(HtmlToData.htmlToData(Settings.getScripts(editor), html), { source1: response.url }); win.fromJSON(data); if (embed) { embed.value(html); SizeManager.updateSize(win); } }; }; var selectPlaceholder = function (editor, beforeObjects) { var i; var y; var afterObjects = editor.dom.select('img[data-mce-object]'); for (i = 0; i < beforeObjects.length; i++) { for (y = afterObjects.length - 1; y >= 0; y--) { if (beforeObjects[i] === afterObjects[y]) { afterObjects.splice(y, 1); } } } editor.selection.select(afterObjects[0]); }; var handleInsert = function (editor, html) { var beforeObjects = editor.dom.select('img[data-mce-object]'); editor.insertContent(html); selectPlaceholder(editor, beforeObjects); editor.nodeChanged(); }; var submitForm = function (win, editor) { var data = win.toJSON(); data.embed = UpdateHtml.updateHtml(data.embed, data); if (data.embed && Service.isCached(data.source1)) { handleInsert(editor, data.embed); } else { Service.getEmbedHtml(editor, data).then(function (response) { handleInsert(editor, response.html); }).catch(handleError(editor)); } }; var populateMeta = function (win, meta) { global$2.each(meta, function (value, key) { win.find('#' + key).value(value); }); }; var showDialog = function (editor) { var win; var data; var generalFormItems = [{ name: 'source1', type: 'filepicker', filetype: 'media', size: 40, autofocus: true, label: 'Source', onpaste: function () { setTimeout(function () { Service.getEmbedHtml(editor, win.toJSON()).then(addEmbedHtml(win, editor)).catch(handleError(editor)); }, 1); }, onchange: function (e) { Service.getEmbedHtml(editor, win.toJSON()).then(addEmbedHtml(win, editor)).catch(handleError(editor)); populateMeta(win, e.meta); }, onbeforecall: function (e) { e.meta = win.toJSON(); } }]; var advancedFormItems = []; var reserialise = function (update) { update(win); data = win.toJSON(); win.find('#embed').value(UpdateHtml.updateHtml(data.embed, data)); }; if (Settings.hasAltSource(editor)) { advancedFormItems.push({ name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source' }); } if (Settings.hasPoster(editor)) { advancedFormItems.push({ name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster' }); } if (Settings.hasDimensions(editor)) { var control = SizeManager.createUi(reserialise); generalFormItems.push(control); } data = getData(editor); var embedTextBox = { id: 'mcemediasource', type: 'textbox', flex: 1, name: 'embed', value: getSource(editor), multiline: true, rows: 5, label: 'Source' }; var updateValueOnChange = function () { data = global$2.extend({}, HtmlToData.htmlToData(Settings.getScripts(editor), this.value())); this.parent().parent().fromJSON(data); }; embedTextBox[embedChange] = updateValueOnChange; var body = [ { title: 'General', type: 'form', items: generalFormItems }, { title: 'Embed', type: 'container', layout: 'flex', direction: 'column', align: 'stretch', padding: 10, spacing: 10, items: [ { type: 'label', text: 'Paste your embed code below:', forId: 'mcemediasource' }, embedTextBox ] } ]; if (advancedFormItems.length > 0) { body.push({ title: 'Advanced', type: 'form', items: advancedFormItems }); } win = editor.windowManager.open({ title: 'Insert/edit media', data: data, bodyType: 'tabpanel', body: body, onSubmit: function () { SizeManager.updateSize(win); submitForm(win, editor); } }); SizeManager.syncSize(win); }; var Dialog = { showDialog: showDialog }; var get$1 = function (editor) { var showDialog = function () { Dialog.showDialog(editor); }; return { showDialog: showDialog }; }; var Api = { get: get$1 }; var register = function (editor) { var showDialog = function () { Dialog.showDialog(editor); }; editor.addCommand('mceMedia', showDialog); }; var Commands = { register: register }; var global$8 = tinymce.util.Tools.resolve('tinymce.html.Node'); var sanitize = function (editor, html) { if (Settings.shouldFilterHtml(editor) === false) { return html; } var writer = global$7(); var blocked; global$4({ validate: false, allow_conditional_comments: false, special: 'script,noscript', comment: function (text) { writer.comment(text); }, cdata: function (text) { writer.cdata(text); }, text: function (text, raw) { writer.text(text, raw); }, start: function (name, attrs, empty) { blocked = true; if (name === 'script' || name === 'noscript' || name === 'svg') { return; } for (var i = attrs.length - 1; i >= 0; i--) { var attrName = attrs[i].name; if (attrName.indexOf('on') === 0) { delete attrs.map[attrName]; attrs.splice(i, 1); } if (attrName === 'style') { attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name); } } writer.start(name, attrs, empty); blocked = false; }, end: function (name) { if (blocked) { return; } writer.end(name); } }, global$6({})).parse(html); return writer.getContent(); }; var Sanitize = { sanitize: sanitize }; var createPlaceholderNode = function (editor, node) { var placeHolder; var name = node.name; placeHolder = new global$8('img', 1); placeHolder.shortEnded = true; retainAttributesAndInnerHtml(editor, node, placeHolder); placeHolder.attr({ 'width': node.attr('width') || '300', 'height': node.attr('height') || (name === 'audio' ? '30' : '150'), 'style': node.attr('style'), 'src': global$1.transparentSrc, 'data-mce-object': name, 'class': 'mce-object mce-object-' + name }); return placeHolder; }; var createPreviewIframeNode = function (editor, node) { var previewWrapper; var previewNode; var shimNode; var name = node.name; previewWrapper = new global$8('span', 1); previewWrapper.attr({ 'contentEditable': 'false', 'style': node.attr('style'), 'data-mce-object': name, 'class': 'mce-preview-object mce-object-' + name }); retainAttributesAndInnerHtml(editor, node, previewWrapper); previewNode = new global$8(name, 1); previewNode.attr({ src: node.attr('src'), allowfullscreen: node.attr('allowfullscreen'), style: node.attr('style'), class: node.attr('class'), width: node.attr('width'), height: node.attr('height'), frameborder: '0' }); shimNode = new global$8('span', 1); shimNode.attr('class', 'mce-shim'); previewWrapper.append(previewNode); previewWrapper.append(shimNode); return previewWrapper; }; var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) { var attrName; var attrValue; var attribs; var ai; var innerHtml; attribs = sourceNode.attributes; ai = attribs.length; while (ai--) { attrName = attribs[ai].name; attrValue = attribs[ai].value; if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') { if (attrName === 'data' || attrName === 'src') { attrValue = editor.convertURL(attrValue, attrName); } targetNode.attr('data-mce-p-' + attrName, attrValue); } } innerHtml = sourceNode.firstChild && sourceNode.firstChild.value; if (innerHtml) { targetNode.attr('data-mce-html', escape(Sanitize.sanitize(editor, innerHtml))); targetNode.firstChild = null; } }; var isWithinEphoxEmbed = function (node) { while (node = node.parent) { if (node.attr('data-ephox-embed-iri')) { return true; } } return false; }; var placeHolderConverter = function (editor) { return function (nodes) { var i = nodes.length; var node; var videoScript; while (i--) { node = nodes[i]; if (!node.parent) { continue; } if (node.parent.attr('data-mce-object')) { continue; } if (node.name === 'script') { videoScript = VideoScript.getVideoScriptMatch(Settings.getScripts(editor), node.attr('src')); if (!videoScript) { continue; } } if (videoScript) { if (videoScript.width) { node.attr('width', videoScript.width.toString()); } if (videoScript.height) { node.attr('height', videoScript.height.toString()); } } if (node.name === 'iframe' && Settings.hasLiveEmbeds(editor) && global$1.ceFalse) { if (!isWithinEphoxEmbed(node)) { node.replace(createPreviewIframeNode(editor, node)); } } else { if (!isWithinEphoxEmbed(node)) { node.replace(createPlaceholderNode(editor, node)); } } } }; }; var Nodes = { createPreviewIframeNode: createPreviewIframeNode, createPlaceholderNode: createPlaceholderNode, placeHolderConverter: placeHolderConverter }; var setup = function (editor) { editor.on('preInit', function () { var specialElements = editor.schema.getSpecialElements(); global$2.each('video audio iframe object'.split(' '), function (name) { specialElements[name] = new RegExp(']*>', 'gi'); }); var boolAttrs = editor.schema.getBoolAttrs(); global$2.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) { boolAttrs[name] = {}; }); editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', Nodes.placeHolderConverter(editor)); editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) { var i = nodes.length; var node; var realElm; var ai; var attribs; var innerHtml; var innerNode; var realElmName; var className; while (i--) { node = nodes[i]; if (!node.parent) { continue; } realElmName = node.attr(name); realElm = new global$8(realElmName, 1); if (realElmName !== 'audio' && realElmName !== 'script') { className = node.attr('class'); if (className && className.indexOf('mce-preview-object') !== -1) { realElm.attr({ width: node.firstChild.attr('width'), height: node.firstChild.attr('height') }); } else { realElm.attr({ width: node.attr('width'), height: node.attr('height') }); } } realElm.attr({ style: node.attr('style') }); attribs = node.attributes; ai = attribs.length; while (ai--) { var attrName = attribs[ai].name; if (attrName.indexOf('data-mce-p-') === 0) { realElm.attr(attrName.substr(11), attribs[ai].value); } } if (realElmName === 'script') { realElm.attr('type', 'text/javascript'); } innerHtml = node.attr('data-mce-html'); if (innerHtml) { innerNode = new global$8('#text', 3); innerNode.raw = true; innerNode.value = Sanitize.sanitize(editor, unescape(innerHtml)); realElm.append(innerNode); } node.replace(realElm); } }); }); editor.on('setContent', function () { editor.$('span.mce-preview-object').each(function (index, elm) { var $elm = editor.$(elm); if ($elm.find('span.mce-shim', elm).length === 0) { $elm.append(''); } }); }); }; var FilterContent = { setup: setup }; var setup$1 = function (editor) { editor.on('ResolveName', function (e) { var name; if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) { e.name = name; } }); }; var ResolveName = { setup: setup$1 }; var setup$2 = function (editor) { editor.on('click keyup', function () { var selectedNode = editor.selection.getNode(); if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) { if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) { selectedNode.setAttribute('data-mce-selected', '2'); } } }); editor.on('ObjectSelected', function (e) { var objectType = e.target.getAttribute('data-mce-object'); if (objectType === 'audio' || objectType === 'script') { e.preventDefault(); } }); editor.on('objectResized', function (e) { var target = e.target; var html; if (target.getAttribute('data-mce-object')) { html = target.getAttribute('data-mce-html'); if (html) { html = unescape(html); target.setAttribute('data-mce-html', escape(UpdateHtml.updateHtml(html, { width: e.width, height: e.height }))); } } }); }; var Selection = { setup: setup$2 }; var register$1 = function (editor) { editor.addButton('media', { tooltip: 'Insert/edit media', cmd: 'mceMedia', stateSelector: [ 'img[data-mce-object]', 'span[data-mce-object]', 'div[data-ephox-embed-iri]' ] }); editor.addMenuItem('media', { icon: 'media', text: 'Media', cmd: 'mceMedia', context: 'insert', prependToContext: true }); }; var Buttons = { register: register$1 }; global.add('media', function (editor) { Commands.register(editor); Buttons.register(editor); ResolveName.setup(editor); FilterContent.setup(editor); Selection.setup(editor); return Api.get(editor); }); function Plugin () { } return Plugin; }()); })(); media/plugin.min.js000064400000040300147331520370010243 0ustar00!function(){"use strict";var e,t,r,n,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),w=function(e){return e.getParam("media_scripts")},b=function(e){return e.getParam("audio_template_callback")},y=function(e){return e.getParam("video_template_callback")},a=function(e){return e.getParam("media_live_embeds",!0)},u=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},m=function(e){return e.getParam("media_alt_source",!0)},d=function(e){return e.getParam("media_poster",!0)},h=function(e){return e.getParam("media_dimensions",!0)},f=function(e){var t=e,r=function(){return t};return{get:r,set:function(e){t=e},clone:function(){return f(r())}}},c=function(){},l=function(e){return function(){return e}},p=l(!1),g=l(!0),x=function(){return O},O=(e=function(e){return e.isNone()},n={fold:function(e,t){return e()},is:p,isSome:p,isNone:g,getOr:r=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:l(null),getOrUndefined:l(undefined),or:r,orThunk:t,map:x,each:c,bind:x,exists:p,forall:g,filter:x,equals:e,equals_:e,toArray:function(){return[]},toString:l("none()")},Object.freeze&&Object.freeze(n),n),j=function(r){var e=l(r),t=function(){return i},n=function(e){return e(r)},i={fold:function(e,t){return t(r)},is:function(e){return r===e},isSome:g,isNone:p,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return j(e(r))},each:function(e){e(r)},bind:n,exists:n,forall:n,filter:function(e){return e(r)?i:O},toArray:function(){return[r]},toString:function(){return"some("+r+")"},equals:function(e){return e.is(r)},equals_:function(e,t){return e.fold(p,function(e){return t(r,e)})}};return i},_=x,S=function(e){return null===e||e===undefined?O:j(e)},k=Object.hasOwnProperty,N=function(e,t){return M(e,t)?S(e[t]):_()},M=function(e,t){return k.call(e,t)},T=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),z=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),A=function(e,t){if(e)for(var r=0;r"):"application/x-shockwave-flash"===n.source1mime?(d='',m.poster&&(d+=''),d+=""):-1!==n.source1mime.indexOf("audio")?(s=n,(l=p)?l(s):'"):"script"===n.type?'