egroupware_official/api/js/tinymce/plugins/inlite/plugin.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var n,e,r,t,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=0,i=function(n,e,r){var t,o,i;n.plugins.table?n.plugins.table.insertTable(e,r):(o=e,i=r,(t=n).undoManager.transact(function(){var n,e;t.insertContent(function(n,e){var r,t,o;for(o='<table data-mce-id="mce" style="width: 100%">',o+="<tbody>",t=0;t<e;t++){for(o+="<tr>",r=0;r<n;r++)o+="<td><br></td>";o+="</tr>"}return o+="</tbody>",o+="</table>"}(o,i)),(n=t.dom.select("*[data-mce-id]")[0]).removeAttribute("data-mce-id"),e=t.dom.select("td,th",n),t.selection.setCursorLocation(e[0],0)}))},u=function(n,e,r){var t,o,i,u;o=(t=n.editorUpload.blobCache).create((i="mceu",u=(new Date).getTime(),i+"_"+Math.floor(1e9*Math.random())+ ++c+String(u)),r,e),t.add(o),n.insertContent(n.dom.createHTML("img",{src:o.blobUri()}))},s="undefined"!=typeof window?window:Function("return this;")(),a=function(n,e){return function(n,e){for(var r=e!==undefined&&null!==e?e:s,t=0;t<n.length&&r!==undefined&&null!==r;++t)r=r[n[t]];return r}(n.split("."),e)},f=function(n,e){var r=a(n,e);if(r===undefined||null===r)throw n+" not available on this browser";return r},d=tinymce.util.Tools.resolve("tinymce.util.Promise"),l=function(t){return new d(function(n){var e=function r(){return new(f("FileReader"))}();e.onloadend=function(){n(e.result.split(",")[1])},e.readAsDataURL(t)})},m=function(){return new d(function(e){var n;(n=document.createElement("input")).type="file",n.style.position="fixed",n.style.left=0,n.style.top=0,n.style.opacity=.001,document.body.appendChild(n),n.onchange=function(n){e(Array.prototype.slice.call(n.target.files))},n.click(),n.parentNode.removeChild(n)})},v=function(r){r.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:function(){m().then(function(n){var e=n[0];l(e).then(function(n){u(r,n,e)})})}}),r.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:function(){i(r,2,2)}})},h=function(n){return function(){return n}},g=h(!1),T=h(!0),p=g,N=T,E=function(){return O},O=(t={fold:function(n,e){return n()},is:p,isSome:p,isNone:N,getOr:r=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:e,map:E,ap:E,each:function(){},bind:E,flatten:E,exists:p,forall:N,filter:E,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:h("none()")},Object.freeze&&Object.freeze(t),t),y=function(r){var n=function(){return r},e=function(){return o},t=function(n){return n(r)},o={fold:function(n,e){return e(r)},is:function(n){return r===n},isSome:N,isNone:p,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return y(n(r))},ap:function(n){return n.fold(E,function(n){return y(n(r))})},each:function(n){n(r)},bind:t,flatten:n,exists:t,forall:t,filter:function(n){return n(r)?o:O},equals:function(n){return n.is(r)},equals_:function(n,e){return n.fold(p,function(n){return e(r,n)})},toArray:function(){return[r]},toString:function(){return"some("+r+")"}};return o},b={some:y,none:E,from:function(n){return null===n||n===undefined?O:y(n)}},S=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:h(n)}},w={fromHtml:function(n,e){var r=(e||document).createElement("div");if(r.innerHTML=n,!r.hasChildNodes()||1<r.childNodes.length)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return S(r.childNodes[0])},fromTag:function(n,e){var r=(e||document).createElement(n);return S(r)},fromText:function(n,e){var r=(e||document).createTextNode(n);return S(r)},fromDom:S,fromPoint:function(n,e,r){var t=n.dom();return b.from(t.elementFromPoint(e,r)).map(S)}},x={ATTRIBUTE:Node.ATTRIBUTE_NODE,CDATA_SECTION:Node.CDATA_SECTION_NODE,COMMENT:Node.COMMENT_NODE,DOCUMENT:Node.DOCUMENT_NODE,DOCUMENT_TYPE:Node.DOCUMENT_TYPE_NODE,DOCUMENT_FRAGMENT:Node.DOCUMENT_FRAGMENT_NODE,ELEMENT:Node.ELEMENT_NODE,TEXT:Node.TEXT_NODE,PRO