toastui-react-image-editor.js
4.29 KB
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("tui-image-editor")},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return v}));var r=n(0),o=n.n(r),i=n(1),u=n.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?y(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;f(this,t);for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];return d(y(n=s(this,(e=p(t)).call.apply(e,[this].concat(i)))),"rootEl",o.a.createRef()),d(y(n),"imageEditorInst",null),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this.imageEditorInst=new u.a(this.rootEl.current,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props)),this.bindEventHandlers(this.props)}},{key:"componentWillUnmount",value:function(){this.unbindEventHandlers(),this.imageEditorInst.destroy(),this.imageEditorInst=null}},{key:"shouldComponentUpdate",value:function(e){return this.bindEventHandlers(this.props,e),!1}},{key:"getInstance",value:function(){return this.imageEditorInst}},{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"bindEventHandlers",value:function(e,t){var n=this;Object.keys(e).filter(this.isEventHandlerKeys).forEach((function(r){var o=r[2].toLowerCase()+r.slice(3);t&&t[r]!==e[r]&&n.imageEditorInst.off(o),n.imageEditorInst.on(o,e[r])}))}},{key:"unbindEventHandlers",value:function(){var e=this;Object.keys(this.props).filter(this.isEventHandlerKeys).forEach((function(t){var n=t[2].toLowerCase()+t.slice(3);e.imageEditorInst.off(n)}))}},{key:"isEventHandlerKeys",value:function(e){return/on[A-Z][a-zA-Z]+/.test(e)}},{key:"render",value:function(){return o.a.createElement("div",{ref:this.rootEl})}}])&&l(n.prototype,r),i&&l(n,i),t}(o.a.Component)}]);