@gaoding/editor-sdk
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -129,3 +129,3 @@ module.exports = | ||
var hide = __webpack_require__(19); | ||
var has = __webpack_require__(7); | ||
var has = __webpack_require__(8); | ||
var PROTOTYPE = 'prototype'; | ||
@@ -222,2 +222,8 @@ | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(28); | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports) { | ||
@@ -232,3 +238,3 @@ | ||
/***/ }), | ||
/* 8 */ | ||
/* 9 */ | ||
/***/ (function(module, exports) { | ||
@@ -241,3 +247,3 @@ | ||
/***/ }), | ||
/* 9 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -254,3 +260,3 @@ | ||
/***/ }), | ||
/* 10 */ | ||
/* 11 */ | ||
/***/ (function(module, exports) { | ||
@@ -267,3 +273,3 @@ | ||
/***/ }), | ||
/* 11 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -274,8 +280,2 @@ | ||
/***/ }), | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(28); | ||
/***/ }), | ||
/* 13 */ | ||
@@ -294,5 +294,5 @@ /***/ (function(module, exports, __webpack_require__) { | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GdEditorSdk", function() { return GdEditorSdk; }); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_parse_float__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_parse_float__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_parse_float__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_parse_float__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_object_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_object_keys__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); | ||
/* harmony import */ var _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_object_keys__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_object_keys__WEBPACK_IMPORTED_MODULE_1__); | ||
@@ -324,3 +324,3 @@ | ||
if (!config.onUpload) { | ||
throw new Error(''); | ||
throw new Error('缺少必填参数 onUpload'); | ||
} | ||
@@ -336,4 +336,5 @@ | ||
* | ||
* @param {{ filter: string }} options | ||
* @param {{ filter: string; ext: {[k: string]: string} }} options | ||
* @param options.filter 筛选项 | ||
* @param options.ext 扩展查询参数,用于渠道统计 | ||
* @memberof GdEditorSdk | ||
@@ -391,3 +392,10 @@ */ | ||
this.createMask(); | ||
this.frame.src = "https://www.gaoding.com/utm-editors/" + encodeURIComponent(location.hostname) + "?filter=" + options.filter; | ||
var ext = options.ext || {}; | ||
var extQuery = _Users_tianwu_work_editor_sdk_node_modules_babel_runtime_corejs2_core_js_object_keys__WEBPACK_IMPORTED_MODULE_1___default()(ext).reduce(function (str, key) { | ||
str += "&" + key + "=" + ext[key]; | ||
return str; | ||
}, ''); | ||
this.frame.src = "https://www.gaoding.com/utm-editors/" + encodeURIComponent(location.hostname) + "?filter=" + options.filter + extQuery; | ||
document.body.appendChild(this.wrapper); | ||
@@ -625,3 +633,3 @@ } | ||
module.exports = 1 / $parseFloat(__webpack_require__(8) + '-0') !== -Infinity ? function parseFloat(str) { | ||
module.exports = 1 / $parseFloat(__webpack_require__(9) + '-0') !== -Infinity ? function parseFloat(str) { | ||
var string = $trim(String(str), 3); | ||
@@ -640,3 +648,3 @@ var result = $parseFloat(string); | ||
var fails = __webpack_require__(2); | ||
var spaces = __webpack_require__(8); | ||
var spaces = __webpack_require__(9); | ||
var space = '[' + spaces + ']'; | ||
@@ -721,4 +729,4 @@ var non = '\u200b\u0085'; | ||
var has = __webpack_require__(7); | ||
var toIObject = __webpack_require__(9); | ||
var has = __webpack_require__(8); | ||
var toIObject = __webpack_require__(10); | ||
var arrayIndexOf = __webpack_require__(35)(false); | ||
@@ -770,3 +778,3 @@ var IE_PROTO = __webpack_require__(38)('IE_PROTO'); | ||
// true -> Array#includes | ||
var toIObject = __webpack_require__(9); | ||
var toIObject = __webpack_require__(10); | ||
var toLength = __webpack_require__(36); | ||
@@ -799,3 +807,3 @@ var toAbsoluteIndex = __webpack_require__(37); | ||
// 7.1.15 ToLength | ||
var toInteger = __webpack_require__(10); | ||
var toInteger = __webpack_require__(11); | ||
var min = Math.min; | ||
@@ -811,3 +819,3 @@ module.exports = function (it) { | ||
var toInteger = __webpack_require__(10); | ||
var toInteger = __webpack_require__(11); | ||
var max = Math.max; | ||
@@ -814,0 +822,0 @@ var min = Math.min; |
@@ -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(7),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){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(28)},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(11),o=n.n(r),i=n(12),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("");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="1280px",r.style.minHeight="604px",r.style.height=document.documentElement.clientHeight-100+"px",r.style.maxHeight="720px",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(),this.frame.src="https://www.gaoding.com/utm-editors/"+encodeURIComponent(location.hostname)+"?filter="+t.filter,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(8)+"-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(8),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(7),o=n(9),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(9),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(10),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(10),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,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="1280px",r.style.minHeight="604px",r.style.height=document.documentElement.clientHeight-100+"px",r.style.maxHeight="720px",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},"");this.frame.src="https://www.gaoding.com/utm-editors/"+encodeURIComponent(location.hostname)+"?filter="+t.filter+c,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)}}])}); |
@@ -29,4 +29,5 @@ interface IConfig { | ||
* | ||
* @param {{ filter: string }} options | ||
* @param {{ filter: string; ext: {[k: string]: string} }} options | ||
* @param options.filter 筛选项 | ||
* @param options.ext 扩展查询参数,用于渠道统计 | ||
* @memberof GdEditorSdk | ||
@@ -36,2 +37,5 @@ */ | ||
filter: string; | ||
ext: { | ||
[k: string]: string; | ||
}; | ||
}): void; | ||
@@ -38,0 +42,0 @@ /** |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (!config.onUpload) { | ||
throw new Error(''); | ||
throw new Error('缺少必填参数 onUpload'); | ||
} | ||
@@ -27,4 +27,5 @@ this.config = config; | ||
* | ||
* @param {{ filter: string }} options | ||
* @param {{ filter: string; ext: {[k: string]: string} }} options | ||
* @param options.filter 筛选项 | ||
* @param options.ext 扩展查询参数,用于渠道统计 | ||
* @memberof GdEditorSdk | ||
@@ -75,3 +76,8 @@ */ | ||
this.createMask(); | ||
this.frame.src = "https://www.gaoding.com/utm-editors/" + encodeURIComponent(location.hostname) + "?filter=" + options.filter; | ||
var ext = options.ext || {}; | ||
var extQuery = Object.keys(ext).reduce(function (str, key) { | ||
str += "&" + key + "=" + ext[key]; | ||
return str; | ||
}, ''); | ||
this.frame.src = "https://www.gaoding.com/utm-editors/" + encodeURIComponent(location.hostname) + "?filter=" + options.filter + extQuery; | ||
document.body.appendChild(this.wrapper); | ||
@@ -78,0 +84,0 @@ }; |
{ | ||
"name": "@gaoding/editor-sdk", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "稿定编辑器对外 SDK", | ||
@@ -19,9 +19,5 @@ "main": "lib/index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@git.gaoding.com:gaoding/editor-sdk.git" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"license": "UNLICENSE", | ||
"devDependencies": { | ||
@@ -28,0 +24,0 @@ "@gaoding/eslint-config-typescript": "1.1.3", |
@@ -67,7 +67,10 @@ # editor-sdk | ||
* @param {{ filter: string }} options | ||
* @param options.filter: string 筛选项 | ||
* @param options.filter 筛选项 | ||
* @memberof GdEditorSdk | ||
*/ | ||
open(options: { | ||
categoryId: number; | ||
filter: string; | ||
ext: { | ||
[k: string]: string; | ||
}; | ||
}): void; | ||
@@ -74,0 +77,0 @@ /** |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
45517
908
84
1