agenda-libre-ruby/public/assets/tinymce/plugins/image/plugin-f784f22299b8db7c3326...

2 lines
13 KiB
JavaScript
Raw Normal View History

2018-02-19 14:21:53 +01:00
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),n={hasDimensions:function(e){return!1!==e.settings.image_dimensions},hasAdvTab:function(e){return!0===e.settings.image_advtab},getPrependUrl:function(e){return e.getParam("image_prepend_url","")},getClassList:function(e){return e.getParam("image_class_list")},hasDescription:function(e){return!1!==e.settings.image_description},hasImageTitle:function(e){return!0===e.settings.image_title},hasImageCaption:function(e){return!0===e.settings.image_caption},getImageList:function(e){return e.getParam("image_list",!1)},hasUploadUrl:function(e){return e.getParam("images_upload_url",!1)},hasUploadHandler:function(e){return e.getParam("images_upload_handler",!1)},getUploadUrl:function(e){return e.getParam("images_upload_url")},getUploadHandler:function(e){return e.getParam("images_upload_handler")},getUploadBasePath:function(e){return e.getParam("images_upload_base_path")},getUploadCredentials:function(e){return e.getParam("images_upload_credentials")}},a="undefined"!=typeof window?window:Function("return this;")(),i=function(e,t){for(var n=t!==undefined&&null!==t?t:a,i=0;i<e.length&&n!==undefined&&null!==n;++i)n=n[e[i]];return n},r=function(e,t){var n=e.split(".");return i(n,t)},o={getOrDie:function(e,t){var n=r(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n}};function l(){return new(o.getOrDie("FileReader"))}var s=tinymce.util.Tools.resolve("tinymce.util.Promise"),c=tinymce.util.Tools.resolve("tinymce.util.XHR"),u=function(e,t){return Math.max(parseInt(e,10),parseInt(t,10))},g={getImageSize:function(e,t){var n=document.createElement("img");function a(e,a){n.parentNode&&n.parentNode.removeChild(n),t({width:e,height:a})}n.onload=function(){a(u(n.width,n.clientWidth),u(n.height,n.clientHeight))},n.onerror=function(){a(0,0)};var i=n.style;i.visibility="hidden",i.position="fixed",i.bottom=i.left="0px",i.width=i.height="auto",document.body.appendChild(n),n.src=e},buildListItems:function(e,n,a){return function i(e,a){return a=a||[],t.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=i(e.menu):(t.value=e.value,n(t)),a.push(t)}),a}(e,a||[])},removePixelSuffix:function(e){return e&&(e=e.replace(/px$/,"")),e},addPixelSuffix:function(e){return e.length>0&&/^[0-9]+$/.test(e)&&(e+="px"),e},mergeMargins:function(e){if(e.margin){var t=e.margin.split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e},createImageList:function(e,t){var a=n.getImageList(e);"string"==typeof a?c.send({url:a,success:function(e){t(JSON.parse(e))}}):"function"==typeof a?a(t):t(a)},waitLoadImage:function(e,t,a){function i(){a.onload=a.onerror=null,e.selection&&(e.selection.select(a),e.nodeChanged())}a.onload=function(){t.width||t.height||!n.hasDimensions(e)||e.dom.setAttribs(a,{width:a.clientWidth,height:a.clientHeight}),i()},a.onerror=i},blobToDataUri:function(e){return new s(function(t,n){var a=new l;a.onload=function(){t(a.result)},a.onerror=function(){n(l.error.message)},a.readAsDataURL(e)})}},d={makeTab:function(e,t){return{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:(a=e,function(e){var t=a.dom,i=e.control.rootControl;if(n.hasAdvTab(a)){var r=i.toJSON(),o=t.parseStyle(r.style);i.find("#vspace").value(""),i.find("#hspace").value(""),((o=g.mergeMargi