2 lines
133 KiB
JavaScript
2 lines
133 KiB
JavaScript
|
!function(){"use strict";var t,e,n,i,r,o,s,a=tinymce.util.Tools.resolve("tinymce.ThemeManager"),l=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Delay"),d=function(t){return t.reduce(function(t,e){return Array.isArray(e)?t.concat(d(e)):t.concat(e)},[])},f={flatten:d},h=function(t,e){for(var n=0;n<e.length;n++){var i=(0,e[n])(t);if(i)return i}return null},m=function(t,e){return{id:t,rect:e}},g=function(t){return{x:t.left,y:t.top,w:t.width,h:t.height}},p=function(t){return{left:t.x,top:t.y,width:t.w,height:t.h,right:t.x+t.w,bottom:t.y+t.h}},v=function(t){var e=u.DOM.getViewPort();return{x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},y=function(t){var e=t.getBoundingClientRect();return v({x:e.left,y:e.top,w:Math.max(t.clientWidth,t.offsetWidth),h:Math.max(t.clientHeight,t.offsetHeight)})},b={getElementRect:function(t,e){return y(e)},getPageAreaRect:function(t){return y(t.getElement().ownerDocument.body)},getContentAreaRect:function(t){return y(t.getContentAreaContainer()||t.getBody())},getSelectionRect:function(t){var e=t.selection.getBoundingClientRect();return e?v(g(e)):null}},x=function(t,e){return function(n){for(var i=0;i<e.length;i++)if(e[i].predicate(t))return m(e[i].id,b.getElementRect(n,t));return null}},w=function(t,e){return function(n){for(var i=0;i<t.length;i++)for(var r=0;r<e.length;r++)if(e[r].predicate(t[i]))return m(e[r].id,b.getElementRect(n,t[i]));return null}},_=tinymce.util.Tools.resolve("tinymce.util.Tools"),R=function(t,e){return{id:t,predicate:e}},k=function(t){return _.map(t,function(t){return R(t.id,t.predicate)})},C=function(t){return function(e){return e.selection.isCollapsed()?null:m(t,b.getSelectionRect(e))}},E=function(t,e){return function(n){var i,r=n.schema.getTextBlockElements();for(i=0;i<t.length;i++)if("TABLE"===t[i].nodeName)return null;for(i=0;i<t.length;i++)if(t[i].nodeName in r)return n.dom.isEmpty(t[i])?m(e,b.getSelectionRect(n)):null;return null}},H={fireSkinLoaded:function(t){t.fire("SkinLoaded")},fireBeforeRenderUI:function(t){return t.fire("BeforeRenderUI")}},S=tinymce.util.Tools.resolve("tinymce.EditorManager"),M=function(t){return function(e){return typeof e===t}},T=function(t){return Array.isArray(t)},P=function(t){return null===t},W={isString:M("string"),isNumber:M("number"),isBoolean:M("boolean"),isFunction:M("function"),isObject:(t=M("object"),function(e){return!P(e)&&!T(e)&&t(e)}),isNull:P,isArray:T},N=function(t,e){if(e(t))return!0;throw new Error("Default value doesn't match requested type.")},D=function(t){return function(e,n,i){var r=e.settings;return N(i,t),n in r&&t(r[n])?r[n]:i}},A={getStringOr:D(W.isString),getBoolOr:D(W.isBoolean),getNumberOr:D(W.isNumber),getHandlerOr:D(W.isFunction),getToolbarItemsOr:(e=W.isArray,function(t,n,i){var r,o,s,a,l=n in t.settings?t.settings[n]:i;return N(i,e),r=l,o=i,W.isArray(r)?r:W.isString(r)?"string"==typeof(s=r)?(a=/[ ,]/,s.split(a).filter(function(t){return t.length>0})):s:W.isBoolean(r)&&!1===r?[]:o})},O=tinymce.util.Tools.resolve("tinymce.geom.Rect"),B=function(t,e){return{rect:t,position:e}},L=function(t,e){return{x:e.x,y:e.y,w:t.w,h:t.h}},I=function(t,e,n,i,r){var o,s,a,l={x:i.x,y:i.y,w:i.w+(i.w<r.w+n.w?r.w:0),h:i.h+(i.h<r.h+n.h?r.h:0)};return o=O.findBestRelativePosition(r,n,l,t),n=O.clamp(n,l),o?(s=O.relativePosition(r,n,o),a=L(r,s),B(a,o)):(n=O.intersect(l,n))?(o=O.findBestRelativePosition(r,n,l,e))?(s=O.relativePosition(r,n,o),a=L(r,s),B(a,o)):(a=L(r,n),B(a,o)):null},z={calcInsert:function(t,e,n){return I(["cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr"],t,e,n)},calc:function(t,e,n){return I(["tc-bc","bc-tc","tl-bl","bl-tl","tr-br","br-tr","cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr","cr-cl"],t,e,n)},userConstrain:function(t,e,n,i){var r;return"function"==typeof t?(r=t({elementRect:p(e),contentAreaRect:p(n),panelRect:p(i)}),g(r)):i},defaultHandler:function(t){return t.panelRect}},F={getTextSelectionToolbarItems:function(t){return A.getToolbarItemsOr(t,"selection_toolbar",["bold","italic","|","quicklink","h2","h3","blockquote"])},getInsertToolbarItems:
|