@gaoding/editor-sdk
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -302,2 +302,3 @@ module.exports = | ||
this.mask = null; | ||
this.container = null; | ||
@@ -321,2 +322,4 @@ this.cb = function (event) { | ||
this.config = config; | ||
this.autoResize(); | ||
window.addEventListener('resize', this.autoResize.bind(this)); | ||
} | ||
@@ -326,2 +329,10 @@ | ||
_proto.autoResize = function autoResize() { | ||
var container = this.container; | ||
if (container) { | ||
container.style.width = Math.max(document.documentElement.clientWidth - 100, 1280) + 'px'; | ||
container.style.height = Math.max(document.documentElement.clientHeight - 80, 604) + 'px'; | ||
} | ||
} | ||
/** | ||
@@ -336,2 +347,4 @@ * 打开iframe 弹窗 | ||
*/ | ||
; | ||
_proto.open = function open(options) { | ||
@@ -359,7 +372,7 @@ var _this2 = this; | ||
this.wrapper = wrapper; | ||
var container = document.createElement('div'); | ||
var container = this.container = document.createElement('div'); | ||
container.style.position = 'relative'; | ||
container.style.width = document.documentElement.clientWidth - 100 + 'px'; | ||
container.style.width = Math.max(document.documentElement.clientWidth - 100, 1280) + 'px'; | ||
container.style.height = Math.max(document.documentElement.clientHeight - 80, 604) + 'px'; | ||
container.style.minHeight = '604px'; | ||
container.style.height = document.documentElement.clientHeight - 80 + 'px'; | ||
container.style.margin = '50px auto'; | ||
@@ -425,2 +438,4 @@ container.style.background = '#fff'; | ||
} | ||
window.removeEventListener('resize', this.autoResize.bind(this)); | ||
}; | ||
@@ -427,0 +442,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["gd-editor-sdk"]=e():t["gd-editor-sdk"]=e()})(this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){var r=n(1),o=n(0),i=n(17),u=n(19),c=n(8),s="prototype",a=function(t,e,n){var f,l,p,d=t&a.F,y=t&a.G,h=t&a.S,v=t&a.P,m=t&a.B,x=t&a.W,g=y?o:o[e]||(o[e]={}),b=g[s],w=y?r:h?r[e]:(r[e]||{})[s];for(f in y&&(n=e),n)l=!d&&w&&void 0!==w[f],l&&c(g,f)||(p=l?w[f]:n[f],g[f]=y&&"function"!=typeof w[f]?n[f]:m&&l?i(p,r):x&&w[f]==p?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e[s]=t[s],e}(p):v&&"function"==typeof p?i(Function.call,p):p,v&&((g.virtual||(g.virtual={}))[f]=p,t&a.R&&b&&!b[f]&&u(b,f,p)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},function(t,e,n){t.exports=!n(2)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){t.exports=n(28)},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){var r=n(33),o=n(6);t.exports=function(t){return r(o(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){t.exports=n(15)},function(t,e,n){t.exports=n(14)},function(t,e,n){"use strict";n.r(e),n.d(e,"GdEditorSdk",function(){return c});var r=n(12),o=n.n(r),i=n(7),u=n.n(i),c=function(){function t(t){var e=this;if(this.wrapper=null,this.frame=null,this.mask=null,this.cb=function(t){if("https://www.gaoding.com"!==t.origin)return!1;"editor.download"===t.data.action&&(e.config.onUpload(t.data.blob),e.close())},!t.onUpload)throw new Error("缺少必填参数 onUpload");this.config=t}var e=t.prototype;return e.open=function(t){var e=this;if(window.addEventListener("message",this.cb),!this.wrapper){var n=document.createElement("div");n.className="gaoding-iframe",n.style.position="absolute",n.style.top="0px",n.style.right="0px",n.style.bottom="0px",n.style.left="0px",n.style.zIndex="1000",document.documentElement.clientHeight>800&&(n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center"),this.wrapper=n;var r=document.createElement("div");r.style.position="relative",r.style.width=document.documentElement.clientWidth-100+"px",r.style.minHeight="604px",r.style.height=document.documentElement.clientHeight-80+"px",r.style.margin="50px auto",r.style.background="#fff",r.style.display="block",r.appendChild(this.createCloseBtn()),this.config.style&&u()(this.config.style).forEach(function(t){r.style[t]=e.config.style[t]});var o=document.createElement("iframe");o.style.display="block",o.style.width="100%",o.style.height="100%",o.setAttribute("frameborder","0"),this.frame=o,r.appendChild(o),n.append(r)}this.createMask();var i=t.ext||{},c=u()(i).reduce(function(t,e){return t+="&"+e+"="+i[e],t},""),s="";t.filter&&(s+="filter="+t.filter),t.filterFont&&(s+="filterFont="+Number(t.filterFont)),s+=""+c,this.frame.src="https://www.gaoding.com/utm-editors/"+encodeURIComponent(location.hostname)+"?"+s,document.body.appendChild(this.wrapper)},e.close=function(){window.removeEventListener("message",this.cb),this.wrapper&&this.wrapper.parentElement&&this.wrapper.parentElement.removeChild(this.wrapper),this.mask&&this.mask.parentElement&&this.mask.parentElement.removeChild(this.mask)},e.createMask=function(){var t=document.createElement("div");t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.bottom="0px",t.style.right="0px",t.style.zIndex=o()(this.wrapper.style.zIndex)-1+"",t.style.backgroundColor="#000",t.style.opacity=".5",this.mask=t,document.body.appendChild(t)},e.createCloseBtn=function(){var t=this,e=document.createElement("div");e.style.fontSize="13px",e.style.width="42px",e.style.height="42px",e.style.textAlign="right",e.style.position="absolute",e.style.right="-42px",e.style.top="0px",e.style.background="#000",e.style.cursor="pointer",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.backgroundRepeat="no-repeat";var n=document.createElement("img");return n.style.display="block",n.style.width="24px",n.src="https://st-gdx.dancf.com/gaodingx/34555636/design/20190509-142237-249d.png",e.appendChild(n),e.addEventListener("click",function(){return t.close()}),e},t}();window&&(window.GdEditorSdk=c)},function(t,e,n){n(16),t.exports=n(0).parseFloat},function(t,e,n){var r=n(3),o=n(26);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(t,e,n){var r=n(18);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(20),o=n(25);t.exports=n(5)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(21),o=n(22),i=n(24),u=Object.defineProperty;e.f=n(5)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(c){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(5)&&!n(2)(function(){return 7!=Object.defineProperty(n(23)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(4),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(1).parseFloat,o=n(27).trim;t.exports=1/r(n(9)+"-0")!==-1/0?function(t){var e=o(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},function(t,e,n){var r=n(3),o=n(6),i=n(2),u=n(9),c="["+u+"]",s=" ",a=RegExp("^"+c+c+"*"),f=RegExp(c+c+"*$"),l=function(t,e,n){var o={},c=i(function(){return!!u[t]()||s[t]()!=s}),a=o[t]=c?e(p):u[t];n&&(o[n]=a),r(r.P+r.F*c,"String",o)},p=l.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(a,"")),2&e&&(t=t.replace(f,"")),t};t.exports=l},function(t,e,n){n(29),t.exports=n(0).Object.keys},function(t,e,n){var r=n(30),o=n(31);n(43)("keys",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(6);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(32),o=n(42);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(8),o=n(10),i=n(35)(!1),u=n(38)("IE_PROTO");t.exports=function(t,e){var n,c=o(t),s=0,a=[];for(n in c)n!=u&&r(c,n)&&a.push(n);while(e.length>s)r(c,n=e[s++])&&(~i(a,n)||a.push(n));return a}},function(t,e,n){var r=n(34);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(10),o=n(36),i=n(37);t.exports=function(t){return function(e,n,u){var c,s=r(e),a=o(s.length),f=i(u,a);if(t&&n!=n){while(a>f)if(c=s[f++],c!=c)return!0}else for(;a>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}}},function(t,e,n){var r=n(11),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(11),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(39)("keys"),o=n(41);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(0),o=n(1),i="__core-js_shared__",u=o[i]||(o[i]={});(t.exports=function(t,e){return u[t]||(u[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(40)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!0},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(3),o=n(0),i=n(2);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",u)}}])}); | ||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["gd-editor-sdk"]=e():t["gd-editor-sdk"]=e()})(this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){var r=n(1),o=n(0),i=n(17),u=n(19),c=n(8),s="prototype",a=function(t,e,n){var f,l,p,d=t&a.F,h=t&a.G,y=t&a.S,m=t&a.P,v=t&a.B,x=t&a.W,g=h?o:o[e]||(o[e]={}),b=g[s],w=h?r:y?r[e]:(r[e]||{})[s];for(f in h&&(n=e),n)l=!d&&w&&void 0!==w[f],l&&c(g,f)||(p=l?w[f]:n[f],g[f]=h&&"function"!=typeof w[f]?n[f]:v&&l?i(p,r):x&&w[f]==p?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e[s]=t[s],e}(p):m&&"function"==typeof p?i(Function.call,p):p,m&&((g.virtual||(g.virtual={}))[f]=p,t&a.R&&b&&!b[f]&&u(b,f,p)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},function(t,e,n){t.exports=!n(2)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){t.exports=n(28)},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){var r=n(33),o=n(6);t.exports=function(t){return r(o(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){t.exports=n(15)},function(t,e,n){t.exports=n(14)},function(t,e,n){"use strict";n.r(e),n.d(e,"GdEditorSdk",function(){return c});var r=n(12),o=n.n(r),i=n(7),u=n.n(i),c=function(){function t(t){var e=this;if(this.wrapper=null,this.frame=null,this.mask=null,this.container=null,this.cb=function(t){if("https://www.gaoding.com"!==t.origin)return!1;"editor.download"===t.data.action&&(e.config.onUpload(t.data.blob),e.close())},!t.onUpload)throw new Error("缺少必填参数 onUpload");this.config=t,this.autoResize(),window.addEventListener("resize",this.autoResize.bind(this))}var e=t.prototype;return e.autoResize=function(){var t=this.container;t&&(t.style.width=Math.max(document.documentElement.clientWidth-100,1280)+"px",t.style.height=Math.max(document.documentElement.clientHeight-80,604)+"px")},e.open=function(t){var e=this;if(window.addEventListener("message",this.cb),!this.wrapper){var n=document.createElement("div");n.className="gaoding-iframe",n.style.position="absolute",n.style.top="0px",n.style.right="0px",n.style.bottom="0px",n.style.left="0px",n.style.zIndex="1000",document.documentElement.clientHeight>800&&(n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center"),this.wrapper=n;var r=this.container=document.createElement("div");r.style.position="relative",r.style.width=Math.max(document.documentElement.clientWidth-100,1280)+"px",r.style.height=Math.max(document.documentElement.clientHeight-80,604)+"px",r.style.minHeight="604px",r.style.margin="50px auto",r.style.background="#fff",r.style.display="block",r.appendChild(this.createCloseBtn()),this.config.style&&u()(this.config.style).forEach(function(t){r.style[t]=e.config.style[t]});var o=document.createElement("iframe");o.style.display="block",o.style.width="100%",o.style.height="100%",o.setAttribute("frameborder","0"),this.frame=o,r.appendChild(o),n.append(r)}this.createMask();var i=t.ext||{},c=u()(i).reduce(function(t,e){return t+="&"+e+"="+i[e],t},""),s="";t.filter&&(s+="filter="+t.filter),t.filterFont&&(s+="filterFont="+Number(t.filterFont)),s+=""+c,this.frame.src="https://www.gaoding.com/utm-editors/"+encodeURIComponent(location.hostname)+"?"+s,document.body.appendChild(this.wrapper)},e.close=function(){window.removeEventListener("message",this.cb),this.wrapper&&this.wrapper.parentElement&&this.wrapper.parentElement.removeChild(this.wrapper),this.mask&&this.mask.parentElement&&this.mask.parentElement.removeChild(this.mask),window.removeEventListener("resize",this.autoResize.bind(this))},e.createMask=function(){var t=document.createElement("div");t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.bottom="0px",t.style.right="0px",t.style.zIndex=o()(this.wrapper.style.zIndex)-1+"",t.style.backgroundColor="#000",t.style.opacity=".5",this.mask=t,document.body.appendChild(t)},e.createCloseBtn=function(){var t=this,e=document.createElement("div");e.style.fontSize="13px",e.style.width="42px",e.style.height="42px",e.style.textAlign="right",e.style.position="absolute",e.style.right="-42px",e.style.top="0px",e.style.background="#000",e.style.cursor="pointer",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.backgroundRepeat="no-repeat";var n=document.createElement("img");return n.style.display="block",n.style.width="24px",n.src="https://st-gdx.dancf.com/gaodingx/34555636/design/20190509-142237-249d.png",e.appendChild(n),e.addEventListener("click",function(){return t.close()}),e},t}();window&&(window.GdEditorSdk=c)},function(t,e,n){n(16),t.exports=n(0).parseFloat},function(t,e,n){var r=n(3),o=n(26);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(t,e,n){var r=n(18);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(20),o=n(25);t.exports=n(5)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(21),o=n(22),i=n(24),u=Object.defineProperty;e.f=n(5)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(c){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(5)&&!n(2)(function(){return 7!=Object.defineProperty(n(23)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(4),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(1).parseFloat,o=n(27).trim;t.exports=1/r(n(9)+"-0")!==-1/0?function(t){var e=o(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},function(t,e,n){var r=n(3),o=n(6),i=n(2),u=n(9),c="["+u+"]",s=" ",a=RegExp("^"+c+c+"*"),f=RegExp(c+c+"*$"),l=function(t,e,n){var o={},c=i(function(){return!!u[t]()||s[t]()!=s}),a=o[t]=c?e(p):u[t];n&&(o[n]=a),r(r.P+r.F*c,"String",o)},p=l.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(a,"")),2&e&&(t=t.replace(f,"")),t};t.exports=l},function(t,e,n){n(29),t.exports=n(0).Object.keys},function(t,e,n){var r=n(30),o=n(31);n(43)("keys",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(6);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(32),o=n(42);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(8),o=n(10),i=n(35)(!1),u=n(38)("IE_PROTO");t.exports=function(t,e){var n,c=o(t),s=0,a=[];for(n in c)n!=u&&r(c,n)&&a.push(n);while(e.length>s)r(c,n=e[s++])&&(~i(a,n)||a.push(n));return a}},function(t,e,n){var r=n(34);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(10),o=n(36),i=n(37);t.exports=function(t){return function(e,n,u){var c,s=r(e),a=o(s.length),f=i(u,a);if(t&&n!=n){while(a>f)if(c=s[f++],c!=c)return!0}else for(;a>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}}},function(t,e,n){var r=n(11),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(11),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(39)("keys"),o=n(41);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(0),o=n(1),i="__core-js_shared__",u=o[i]||(o[i]={});(t.exports=function(t,e){return u[t]||(u[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(40)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports=!0},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(3),o=n(0),i=n(2);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",u)}}])}); |
@@ -26,2 +26,4 @@ interface IConfig { | ||
private mask; | ||
private container; | ||
autoResize(): void; | ||
/** | ||
@@ -28,0 +30,0 @@ * 打开iframe 弹窗 |
@@ -9,2 +9,3 @@ "use strict"; | ||
this.mask = null; | ||
this.container = null; | ||
this.cb = function (event) { | ||
@@ -23,3 +24,12 @@ if (event.origin !== 'https://www.gaoding.com') { | ||
this.config = config; | ||
this.autoResize(); | ||
window.addEventListener('resize', this.autoResize.bind(this)); | ||
} | ||
GdEditorSdk.prototype.autoResize = function () { | ||
var container = this.container; | ||
if (container) { | ||
container.style.width = Math.max(document.documentElement.clientWidth - 100, 1280) + 'px'; | ||
container.style.height = Math.max(document.documentElement.clientHeight - 80, 604) + 'px'; | ||
} | ||
}; | ||
/** | ||
@@ -52,7 +62,7 @@ * 打开iframe 弹窗 | ||
this.wrapper = wrapper; | ||
var container_1 = document.createElement('div'); | ||
var container_1 = this.container = document.createElement('div'); | ||
container_1.style.position = 'relative'; | ||
container_1.style.width = document.documentElement.clientWidth - 100 + 'px'; | ||
container_1.style.width = Math.max(document.documentElement.clientWidth - 100, 1280) + 'px'; | ||
container_1.style.height = Math.max(document.documentElement.clientHeight - 80, 604) + 'px'; | ||
container_1.style.minHeight = '604px'; | ||
container_1.style.height = document.documentElement.clientHeight - 80 + 'px'; | ||
container_1.style.margin = '50px auto'; | ||
@@ -106,2 +116,3 @@ container_1.style.background = '#fff'; | ||
} | ||
window.removeEventListener('resize', this.autoResize.bind(this)); | ||
}; | ||
@@ -108,0 +119,0 @@ GdEditorSdk.prototype.createMask = function () { |
{ | ||
"name": "@gaoding/editor-sdk", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "稿定编辑器对外 SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48195
951