react-markdown-editor-lite
Version:
a light-weight Markdown editor based on React
1 lines • 43.8 kB
JavaScript
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},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=9)}([function(t,e){t.exports=require("react")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);n(11),e.default=function(t){return o.createElement("i",{className:"rmel-iconfont rmel-icon-"+t.type})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(7),r=n(17),i=n(18),a=new(function(){function t(){this.langs={enUS:r.default,zhCN:i.default},this.current="enUS";var t="enUS";if(navigator.language){var e=navigator.language.split("-");t=e[0],1!==e.length&&(t+=e[e.length-1].toUpperCase())}if(navigator.browserLanguage){var n=navigator.browserLanguage.split("-");t=n[0],n[1]&&(t+=n[1].toUpperCase())}this.isAvaliable(t)&&(this.current=t)}return t.prototype.isAvaliable=function(t){return"undefined"!==typeof this.langs[t]},t.prototype.add=function(t,e){this.langs[t]=e},t.prototype.setCurrent=function(t){if(!this.isAvaliable(t))throw new Error("Language "+t+" is not exists");this.current!==t&&(this.current=t,o.default.emit(o.default.EVENT_LANG_CHANGE,this,t,this.langs[t]))},t.prototype.get=function(t,e){var n=this.langs[this.current][t]||"";return e&&Object.keys(e).forEach((function(t){n=n.replace(new RegExp("\\{"+t+"\\}","g"),e[t])})),n},t.prototype.getCurrent=function(){return this.current},t}());e.default=a},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e){return t.call(this,e)||this}return r(e,t),Object.defineProperty(e.prototype,"editor",{get:function(){return this.props.editor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editorConfig",{get:function(){return this.props.editorConfig},enumerable:!0,configurable:!0}),e.prototype.getConfig=function(t,e){return this.props.config&&"undefined"!==typeof this.props.config[t]&&null!==this.props.config[t]?this.props.config[t]:e},e.pluginName="",e.align="left",e}(n(0).Component);e.PluginComponent=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.deepClone=function t(e){if(!e||"object"!==typeof e)return e;var n=Array.isArray(e)?[]:{};if(e&&"object"===typeof e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(e[o]&&"object"===typeof e[o]?n[o]=t(e[o]):n[o]=e[o]);return n},e.isEmpty=function(t){return"undefined"===typeof t||null===t||""===t},e.isPromise=function(t){return t&&(t instanceof Promise||("object"===typeof t||"function"===typeof t)&&"function"===typeof t.then)},e.repeat=function(t,e){for(var n="",o=e;o--;)n+=t;return n},e.isKeyMatch=function(t,e,n,o){if(o&&o.length>0)for(var r=0,i=o;r<i.length;r++){var a=i[r];if("undefined"!==typeof t[a]&&!t[a])return!1}else if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return!1;return t.key?t.key===n:t.keyCode===e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});for(var o=n(4),r={bold:["**","**"],italic:["*","*"],underline:["++","++"],strikethrough:["~~","~~"],quote:["\n> ","\n"],inlinecode:["`","`"],code:["\n```\n","\n```\n"]},i=1;i<=6;i++)r["h"+i]=["\n"+o.repeat("#",i)+" ","\n"];function a(t){for(var e=t.row,n=void 0===e?2:e,o=t.col,r=void 0===o?2:o,i=["|"],a=["|"],l=["|"],s="",u=1;u<=r;u++)i.push(" Head |"),l.push(" --- |"),a.push(" Data |");for(var c=1;c<=n;c++)s+="\n"+a.join("");return"\n"+i.join("")+"\n"+l.join("")+s+"\n"}function l(t,e){var n=e;if(0!==n.indexOf("\n")&&(n="\n"+n),"unordered"===t)return n.replace(/\n/g,"\n* ")+"\n";var o=1;return n.replace(/\n/g,(function(){return"\n"+o+++". "}))+"\n"}e.default=function(t,e,n){if("undefined"!==typeof r[e])return{text:""+r[e][0]+t+r[e][1],selection:{start:r[e][0].length,end:r[e][0].length+t.length}};switch(e){case"unordered":return{text:l("unordered",t)};case"order":return{text:l("order",t)};case"hr":return{text:"\n---\n"};case"table":return{text:a(n)};case"image":return{text:"+")",selection:{start:2,end:t.length+2}};case"link":return{text:"["+t+"]("+(n.linkUrl||"")+")",selection:{start:1,end:t.length+1}}}return{text:t,selection:{start:0,end:t.length}}}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0);n(29);var a=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClose=n.handleClose.bind(n),n}return r(e,t),e.prototype.handleClose=function(t){t.stopPropagation();var e=this.props.onClose;"function"===typeof e&&e()},e.prototype.render=function(){return i.createElement("div",{className:"drop-wrap "+(this.props.show?"show":"hidden"),onClick:this.handleClose},this.props.children)},e}(i.Component);e.default=a},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=new(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT_CHANGE="a1",e.EVENT_FULL_SCREEN="a2",e.EVENT_VIEW_CHANGE="a3",e.EVENT_KEY_DOWN="a4",e.EVENT_LANG_CHANGE="b1",e}return r(e,t),e}(n(16).EventEmitter));e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(21),r=n(5),i=n(4);e.default=function(t,e){return{placeholder:r.default("","image",{target:"Uploading_"+o.v4(),imageUrl:""}).text,uploaded:new Promise((function(n){var o=function(e){n(r.default("","image",{target:t.name,imageUrl:e}).text)},a=e(t,o);i.isPromise(a)&&(!1,a.then(o))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(10),r=n(25),i=n(26),a=n(27),l=n(28),s=n(32),u=n(34),c=n(35),d=n(37),p=n(38);o.default.use(l.default),o.default.use(i.default),o.default.use(p.default),o.default.use(s.default),o.default.use(u.default),o.default.use(r.default),o.default.use(c.default),o.default.use(d.default),o.default.use(a.default);var f=n(3);e.PluginComponent=f.PluginComponent;var h=n(5);e.getDecorated=h.default;var y=n(6);e.DropList=y.default,e.default=o.default},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},a=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,l=i.length;a<l;a++,r++)o[r]=i[a];return o};Object.defineProperty(e,"__esModule",{value:!0});var l=n(0),s=n(1),u=n(12),c=n(14),d=n(2),p=n(7),f=n(19),h=n(5),y=n(20),g=n(4),m=n(8),v=n(22);n(23);var b=n(24),_=function(t){function e(e){var n=t.call(this,e)||this;return n.hasContentChanged=!0,n.scrollScale=1,n.isSyncingScroll=!1,n.shouldSyncScroll="input",n.keyboardListeners=[],n.config=y.default(v.default,n.props.config,n.props),n.state={text:(n.props.value||"").replace(/\u21b5/g,"\n"),html:"",view:n.config.view||v.default.view,fullScreen:!1,table:n.config.table||v.default.table,plugins:n.getPlugins()},n.nodeMdText=l.createRef(),n.nodeMdPreviewWraper=l.createRef(),n.handleChange=n.handleChange.bind(n),n.handlePaste=n.handlePaste.bind(n),n.handleDrop=n.handleDrop.bind(n),n.handleToggleMenu=n.handleToggleMenu.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleLocaleUpdate=n.handleLocaleUpdate.bind(n),n.handleInputScroll=n.handleSyncScroll.bind(n,"input"),n.handlePreviewScroll=n.handleSyncScroll.bind(n,"preview"),n}return r(e,t),e.use=function(t,n){void 0===n&&(n={}),e.plugins.push({comp:t,config:n})},e.prototype.componentDidMount=function(){this.renderHTML(this.props.value||""),p.default.on(p.default.EVENT_LANG_CHANGE,this.handleLocaleUpdate)},e.prototype.componentWillUnmount=function(){p.default.off(p.default.EVENT_LANG_CHANGE,this.handleLocaleUpdate)},e.prototype.componentDidUpdate=function(t){if(t.value!==this.props.value&&this.props.value!==this.state.text){var e=this.props.value;"string"!==typeof e&&(e=String(e).toString()),e=e.replace(/\u21b5/g,"\n"),this.setState({text:e}),this.renderHTML(e)}t.plugins!==this.props.plugins&&this.setState({plugins:this.getPlugins()})},e.prototype.getPlugins=function(){var t=this,n=[];if(this.props.plugins){n=this.props.plugins.map((function(t){return function(t){for(var n=0,o=e.plugins;n<o.length;n++){var r=o[n];if(r.comp.pluginName===t)return r}}(t)})).filter((function(t){return!!t}))}else n=a(e.plugins);var o={};return n.forEach((function(e){"undefined"===typeof o[e.comp.align]&&(o[e.comp.align]=[]),o[e.comp.align].push(l.createElement(e.comp,{editor:t,editorConfig:t.config,config:e.config,key:e.comp.pluginName}))})),o},e.prototype.handleSyncScroll=function(t){var e=this;if(t===this.shouldSyncScroll){var n=this.config.syncScrollMode;(void 0===n?[]:n).includes("input"===t?"rightFollowLeft":"leftFollowRight")&&(this.hasContentChanged&&this.nodeMdText.current&&this.nodeMdPreview&&(this.scrollScale=this.nodeMdText.current.scrollHeight/this.nodeMdPreview.getHeight(),this.hasContentChanged=!1),this.isSyncingScroll||(this.isSyncingScroll=!0,requestAnimationFrame((function(){e.nodeMdText.current&&e.nodeMdPreviewWraper.current&&("input"===t?e.nodeMdPreviewWraper.current.scrollTop=e.nodeMdText.current.scrollTop/e.scrollScale:e.nodeMdText.current.scrollTop=e.nodeMdPreviewWraper.current.scrollTop*e.scrollScale),e.isSyncingScroll=!1}))))}},e.prototype.renderHTML=function(t){var e=this;if(!this.props.renderHTML)return Promise.resolve();var n=this.props.renderHTML(t);return g.isPromise(n)?n.then((function(t){return e.setHtml(t)})):"function"===typeof n?this.setHtml(n()):this.setHtml(n)},e.prototype.setHtml=function(t){var e=this;return new Promise((function(n){e.setState({html:t},n)}))},e.prototype.handleToggleMenu=function(){this.setView({menu:!this.state.view.menu})},e.prototype.handleChange=function(t){t.persist();var e=t.target.value;this.hasContentChanged||(this.hasContentChanged=!0),this.setText(e,t)},e.prototype.handlePaste=function(t){if(this.config.allowPasteImage&&this.config.onImageUpload){var e=(t.nativeEvent.clipboardData||window.clipboardData).items;e&&(t.preventDefault(),this.uploadWithDataTransfer(e))}},e.prototype.handleDrop=function(t){var e;if(this.config.onImageUpload){var n=null===(e=t.nativeEvent.dataTransfer)||void 0===e?void 0:e.items;n&&(t.preventDefault(),this.uploadWithDataTransfer(n))}},e.prototype.handleLocaleUpdate=function(){this.forceUpdate()},e.prototype.clearSelection=function(){this.nodeMdText.current&&this.nodeMdText.current.setSelectionRange(0,0,"none")},e.prototype.getSelection=function(){var t=this.nodeMdText.current;if(!t)return i({},f.initialSelection);var e=t.selectionStart,n=t.selectionEnd;return{start:e,end:n,text:(t.value||"").slice(e,n)}},e.prototype.setSelection=function(t){this.nodeMdText.current&&(this.nodeMdText.current.setSelectionRange(t.start,t.end,"forward"),this.nodeMdText.current.focus())},e.prototype.insertMarkdown=function(t,e){void 0===e&&(e={});var n=this.getSelection(),o=e?i({},e):{};"image"===t&&(o=i(i({},o),{target:e.target||n.text||"",imageUrl:e.imageUrl||this.config.imageUrl})),"link"===t&&(o=i(i({},o),{linkUrl:this.config.linkUrl}));var r=h.default(n.text,t,o);this.insertText(r.text,!0,r.selection)},e.prototype.insertPlaceholder=function(t,e){var n=this;this.insertText(t,!0),e.then((function(e){var o=n.getMdValue().replace(t,e);n.setText(o)}))},e.prototype.insertText=function(t,e,n){void 0===t&&(t=""),void 0===e&&(e=!1);var o=this.state.text,r=void 0===o?"":o,i=this.getSelection(),a=r.slice(0,i.start),l=r.slice(e?i.end:i.start,r.length);this.setText(a+t+l,void 0,n?{start:n.start+a.length,end:n.end+a.length}:{start:a.length,end:a.length})},e.prototype.setText=function(t,e,n){var o=this;void 0===t&&(t="");var r=t.replace(/\u21b5/g,"\n");this.state.text!==t&&(this.setState({text:t},(function(){p.default.emit(p.default.EVENT_CHANGE,t,e,"undefined"===typeof e),n&&setTimeout((function(){return o.setSelection(n)}))})),this.renderHTML(r).then((function(){o.props.onChange&&o.props.onChange({text:r,html:o.getHtmlValue()},e)})))},e.prototype.getMdValue=function(){return this.state.text},e.prototype.getHtmlValue=function(){return"string"===typeof this.state.html?this.state.html:this.nodeMdPreview?this.nodeMdPreview.getHtml():""},e.prototype.onKeyboard=function(t){this.keyboardListeners.includes(t)||this.keyboardListeners.push(t)},e.prototype.offKeyboard=function(t){var e=this.keyboardListeners.indexOf(t);e>=0&&this.keyboardListeners.splice(e,1)},e.prototype.handleKeyDown=function(t){for(var e=0,n=this.keyboardListeners;e<n.length;e++){var o=n[e];if(g.isKeyMatch(t,o.keyCode,o.key,o.withKey))return t.preventDefault(),void o.callback(t)}p.default.emit(p.default.EVENT_KEY_DOWN,t)},e.prototype.getEventType=function(t){switch(t){case"change":return p.default.EVENT_CHANGE;case"fullscreen":return p.default.EVENT_FULL_SCREEN;case"viewchange":return p.default.EVENT_VIEW_CHANGE;case"keydown":return p.default.EVENT_KEY_DOWN}},e.prototype.on=function(t,e){var n=this.getEventType(t);n&&p.default.on(n,e)},e.prototype.off=function(t,e){var n=this.getEventType(t);n&&p.default.off(n,e)},e.prototype.setView=function(t){var e=i(i({},this.state.view),t);this.setState({view:e},(function(){p.default.emit(p.default.EVENT_VIEW_CHANGE,e)}))},e.prototype.getView=function(){return i({},this.state.view)},e.prototype.fullScreen=function(t){this.state.fullScreen!==t&&this.setState({fullScreen:t},(function(){p.default.emit(p.default.EVENT_FULL_SCREEN,t)}))},e.prototype.isFullScreen=function(){return this.state.fullScreen},e.prototype.uploadWithDataTransfer=function(t){var e=this,n=this.config.onImageUpload;if(n){var o=[];Array.prototype.forEach.call(t,(function(t){if("file"===t.kind&&t.type.includes("image")){var r=t.getAsFile();if(r){var i=m.default(r,n);o.push(Promise.resolve(i.placeholder)),i.uploaded.then((function(t){var n=e.getMdValue().replace(i.placeholder,t),o=t.length-i.placeholder.length,r=e.getSelection();e.setText(n,void 0,{start:r.start+o,end:r.start+o})}))}}else"string"===t.kind&&"text/plain"===t.type&&o.push(new Promise((function(e){return t.getAsString(e)})))})),Promise.all(o).then((function(t){var n=t.join(""),o=e.getSelection();e.insertText(n,!0,{start:o.start===o.end?n.length:0,end:n.length})}))}},e.prototype.render=function(){var t=this,e=this.config.canView&&!0===this.config.canView.hideMenu,n=this.state,o=n.view,r=n.fullScreen,i=function(e){return t.state.plugins[e]||[]},a=!!o.menu;return l.createElement("div",{className:"rc-md-editor "+(r?"full":""),style:this.props.style,onKeyDown:this.handleKeyDown,onDrop:this.handleDrop},l.createElement(u.default,{visible:a,left:i("left"),right:i("right")}),l.createElement("div",{className:"editor-container"},e&&l.createElement(c.default,null,l.createElement("span",{className:"button button-type-menu",title:a?"hidden menu":"show menu",onClick:this.handleToggleMenu},l.createElement(s.default,{type:"expand-"+(a?"less":"more")}))),l.createElement("section",{className:"section sec-md "+(o.md?"visible":"in-visible")},l.createElement("textarea",{id:"textarea",ref:this.nodeMdText,name:this.props.name||"textarea",value:this.state.text,className:"section-container input "+(this.config.markdownClass||""),wrap:"hard",onChange:this.handleChange,onScroll:this.handleInputScroll,onMouseOver:function(){return t.shouldSyncScroll="input"},onPaste:this.handlePaste})),l.createElement("section",{className:"section sec-html "+(o.html?"visible":"in-visible")},l.createElement("div",{className:"section-container html-wrap",ref:this.nodeMdPreviewWraper,onMouseOver:function(){return t.shouldSyncScroll="preview"},onScroll:this.handlePreviewScroll},l.createElement(b.HtmlRender,{html:this.state.html,className:this.config.htmlClass,ref:function(e){return t.nodeMdPreview=e}})))))},e.defaultProps={value:""},e.plugins=[],e.addLocale=d.default.add,e.useLocale=d.default.setCurrent,e.getLocale=d.default.getCurrent,e}(l.Component);e.default=_},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);n(13),e.default=function(t){return o.createElement("div",{className:"rc-md-navigation "+(t.visible?"visible":"in-visible")},o.createElement("div",{className:"navigation-nav left"},o.createElement("div",{className:"button-wrap"},t.left)),o.createElement("div",{className:"navigation-nav right"},o.createElement("div",{className:"button-wrap"},t.right)))}},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);n(15),e.default=function(t){return o.createElement("div",{className:"tool-bar",style:t.style},t.children)}},function(t,e,n){},function(t,e){t.exports=require("eventemitter3")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={clearTip:"Are you sure you want to clear all contents?",btnHeader:"Header",btnClear:"Clear",btnBold:"Bold",btnItalic:"Italic",btnUnderline:"Underline",btnStrikethrough:"Strikethrough",btnUnordered:"Unordered list",btnOrdered:"Ordered list",btnQuote:"Quote",btnLineBreak:"Line break",btnInlineCode:"Inline code",btnCode:"Code",btnTable:"Table",btnImage:"Image",btnLink:"Link",btnUndo:"Undo",btnRedo:"Redo",btnFullScreen:"Full screen",btnExitFullScreen:"Exit full screen",btnModeEditor:"Only display editor",btnModePreview:"Only display preview",btnModeAll:"Display both editor and preview"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={clearTip:"\u60a8\u786e\u5b9a\u8981\u6e05\u7a7a\u6240\u6709\u5185\u5bb9\u5417\uff1f",btnHeader:"\u6807\u9898",btnClear:"\u6e05\u7a7a",btnBold:"\u52a0\u7c97",btnItalic:"\u659c\u4f53",btnUnderline:"\u4e0b\u5212\u7ebf",btnStrikethrough:"\u5220\u9664\u7ebf",btnUnordered:"\u65e0\u5e8f\u5217\u8868",btnOrdered:"\u6709\u5e8f\u5217\u8868",btnQuote:"\u5f15\u7528",btnLineBreak:"\u6362\u884c",btnInlineCode:"\u884c\u5185\u4ee3\u7801",btnCode:"\u4ee3\u7801\u5757",btnTable:"\u8868\u683c",btnImage:"\u56fe\u7247",btnLink:"\u94fe\u63a5",btnUndo:"\u64a4\u9500",btnRedo:"\u91cd\u505a",btnFullScreen:"\u5168\u5c4f",btnExitFullScreen:"\u9000\u51fa\u5168\u5c4f",btnModeEditor:"\u4ec5\u663e\u793a\u7f16\u8f91\u5668",btnModePreview:"\u4ec5\u663e\u793a\u9884\u89c8",btnModeAll:"\u663e\u793a\u7f16\u8f91\u5668\u4e0e\u9884\u89c8"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initialSelection={start:0,end:0,text:""}},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=o({},t);return e.forEach((function(t){"object"===typeof t&&Object.entries(t).forEach((function(t){t[0]in r&&(r[t[0]]=t[1])}))})),r}},function(t,e){t.exports=require("uuid")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o={theme:"default",view:{menu:!0,md:!0,html:!0},canView:{menu:!0,md:!0,html:!0,fullScreen:!0,hideMenu:!0},htmlClass:"",markdownClass:"",syncScrollMode:["rightFollowLeft","leftFollowRight"],imageUrl:"",imageAccept:"",linkUrl:"",table:{maxRow:4,maxCol:6},allowPasteImage:!0,onImageUpload:void 0,onCustomImageUpload:void 0};e.default=o},function(t,e,n){},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;return n.el=i.createRef(),n}return r(e,t),e.prototype.getHeight=function(){return this.el.current?this.el.current.offsetHeight:0},e}(i.Component);e.Preview=a;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getHtml=function(){return"string"===typeof this.props.html?this.props.html:this.el.current?this.el.current.innerHTML:""},e.prototype.render=function(){return"string"===typeof this.props.html?i.createElement("div",{ref:this.el,dangerouslySetInnerHTML:{__html:this.props.html},className:this.props.className||"custom-html-style"}):i.createElement("div",{ref:this.el,className:this.props.className||"custom-html-style"},this.props.html)},e}(a);e.HtmlRender=l,e.default=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n}return r(e,t),e.prototype.handleClick=function(){""!==this.editor.getMdValue()&&(window.confirm&&"function"===typeof window.confirm&&window.confirm(l.default.get("clearTip"))&&this.editor.setText(""))},e.prototype.render=function(){return i.createElement("span",{className:"button button-type-clear",title:l.default.get("btnClear"),onClick:this.handleClick},i.createElement(a.default,{type:"delete"}))},e.pluginName="clear",e}(n(3).PluginComponent);e.default=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement(i.Fragment,null,i.createElement("span",{className:"button button-type-bold",title:l.default.get("btnBold"),onClick:function(){return t.editor.insertMarkdown("bold")}},i.createElement(a.default,{type:"bold"})),i.createElement("span",{className:"button button-type-italic",title:l.default.get("btnItalic"),onClick:function(){return t.editor.insertMarkdown("italic")}},i.createElement(a.default,{type:"italic"})),i.createElement("span",{className:"button button-type-underline",title:l.default.get("btnUnderline"),onClick:function(){return t.editor.insertMarkdown("underline")}},i.createElement(a.default,{type:"underline"})),i.createElement("span",{className:"button button-type-strikethrough",title:l.default.get("btnStrikethrough"),onClick:function(){return t.editor.insertMarkdown("strikethrough")}},i.createElement(a.default,{type:"strikethrough"})),i.createElement("span",{className:"button button-type-unordered",title:l.default.get("btnUnordered"),onClick:function(){return t.editor.insertMarkdown("unordered")}},i.createElement(a.default,{type:"list-unordered"})),i.createElement("span",{className:"button button-type-ordered",title:l.default.get("btnOrdered"),onClick:function(){return t.editor.insertMarkdown("order")}},i.createElement(a.default,{type:"list-ordered"})),i.createElement("span",{className:"button button-type-quote",title:l.default.get("btnQuote"),onClick:function(){return t.editor.insertMarkdown("quote")}},i.createElement(a.default,{type:"quote"})),i.createElement("span",{className:"button button-type-hr",title:l.default.get("btnLineBreak"),onClick:function(){return t.editor.insertMarkdown("hr")}},i.createElement(a.default,{type:"wrap"})),i.createElement("span",{className:"button button-type-inlinecode",title:l.default.get("btnInlineCode"),onClick:function(){return t.editor.insertMarkdown("inlinecode")}},i.createElement(a.default,{type:"code"})),i.createElement("span",{className:"button button-type-code",title:l.default.get("btnCode"),onClick:function(){return t.editor.insertMarkdown("code")}},i.createElement(a.default,{type:"code-block"})))},e.pluginName="fonts",e}(n(3).PluginComponent);e.default=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n.handleChange=n.handleChange.bind(n),n.state={enable:n.editor.isFullScreen()},n}return r(e,t),e.prototype.handleClick=function(){this.editor.fullScreen(!this.state.enable)},e.prototype.handleChange=function(t){this.setState({enable:t})},e.prototype.componentDidMount=function(){this.editor.on("fullscreen",this.handleChange)},e.prototype.componentWillUnmount=function(){this.editor.off("fullscreen",this.handleChange)},e.prototype.render=function(){if(this.editorConfig.canView&&this.editorConfig.canView.fullScreen){var t=this.state.enable;return i.createElement("span",{className:"button button-type-fullscreen",title:l.default.get(t?"btnExitFullScreen":"btnFullScreen"),onClick:this.handleClick},i.createElement(a.default,{type:t?"fullscreen-exit":"fullscreen"}))}return null},e.pluginName="full-screen",e.align="right",e}(n(3).PluginComponent);e.default=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(6),l=n(1),s=n(2),u=n(3),c=n(30),d=function(t){function e(e){var n=t.call(this,e)||this;return n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.show=function(){this.setState({show:!0})},e.prototype.hide=function(){this.setState({show:!1})},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-header",title:s.default.get("btnHeader"),onMouseEnter:this.show,onMouseLeave:this.hide},i.createElement(l.default,{type:"font-size"}),i.createElement(a.default,{show:this.state.show,onClose:this.hide},i.createElement(c.default,{onSelectHeader:function(e){return t.editor.insertMarkdown(e)}})))},e.pluginName="header",e}(u.PluginComponent);e.default=d},function(t,e,n){},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0);n(31);var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.handleHeader=function(t){var e=this.props.onSelectHeader;"function"===typeof e&&e(t)},e.prototype.render=function(){return i.createElement("ul",{className:"header-list"},i.createElement("li",{className:"list-item"},i.createElement("h1",{onClick:this.handleHeader.bind(this,"h1")},"H1")),i.createElement("li",{className:"list-item"},i.createElement("h2",{onClick:this.handleHeader.bind(this,"h2")},"H2")),i.createElement("li",{className:"list-item"},i.createElement("h3",{onClick:this.handleHeader.bind(this,"h3")},"H3")),i.createElement("li",{className:"list-item"},i.createElement("h4",{onClick:this.handleHeader.bind(this,"h4")},"H4")),i.createElement("li",{className:"list-item"},i.createElement("h5",{onClick:this.handleHeader.bind(this,"h5")},"H5")),i.createElement("li",{className:"list-item"},i.createElement("h6",{onClick:this.handleHeader.bind(this,"h6")},"H6")))},e}(i.Component);e.default=a},function(t,e,n){},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=n(3),u=n(4),c=n(8),d=n(33),p=function(t){function e(e){var n=t.call(this,e)||this;return n.inputFile=i.createRef(),n.onImageChanged=n.onImageChanged.bind(n),n.handleCustomImageUpload=n.handleCustomImageUpload.bind(n),n.handleImageUpload=n.handleImageUpload.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.handleImageUpload=function(){"function"===typeof this.editorConfig.onImageUpload?this.inputFile.current&&this.inputFile.current.click():this.editor.insertMarkdown("image")},e.prototype.onImageChanged=function(t){var e=this.editorConfig.onImageUpload;if(e){var n=c.default(t,e);this.editor.insertPlaceholder(n.placeholder,n.uploaded)}},e.prototype.handleCustomImageUpload=function(t){var e=this,n=this.editorConfig.onCustomImageUpload;if(n){var o=n.call(this,t);u.isPromise(o)&&o.then((function(t){t&&t.url&&e.editor.insertMarkdown("image",{target:t.text,imageUrl:t.url})}))}},e.prototype.render=function(){var t=this;return!!this.editorConfig.onCustomImageUpload?i.createElement("span",{className:"button button-type-image",title:l.default.get("btnImage"),onClick:this.handleCustomImageUpload},i.createElement(a.default,{type:"image"})):i.createElement("span",{className:"button button-type-image",title:l.default.get("btnImage"),onClick:this.handleImageUpload,style:{position:"relative"}},i.createElement(a.default,{type:"image"}),i.createElement(d.default,{accept:this.editorConfig.imageAccept||"",ref:this.inputFile,onChange:function(e){e.persist(),e.target.files&&e.target.files.length>0&&t.onImageChanged(e.target.files[0])}}))},e.pluginName="image",e}(s.PluginComponent);e.default=p},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;return n.timerId=void 0,n.locked=!1,n.input=i.createRef(),n}return r(e,t),e.prototype.click=function(){var t=this;!this.locked&&this.input.current&&(this.locked=!0,this.input.current.value="",this.input.current.click(),this.timerId&&window.clearTimeout(this.timerId),this.timerId=window.setTimeout((function(){t.locked=!1,window.clearTimeout(t.timerId),t.timerId=void 0}),200))},e.prototype.componentWillUnmount=function(){this.timerId&&window.clearTimeout(this.timerId)},e.prototype.render=function(){return i.createElement("input",{type:"file",ref:this.input,accept:this.props.accept,style:{position:"absolute",zIndex:-1,left:0,top:0,width:0,height:0,opacity:0},onChange:this.props.onChange})},e}(i.Component);e.default=a},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-link",title:l.default.get("btnLink"),onClick:function(){return t.editor.insertMarkdown("link")}},i.createElement(a.default,{type:"link"}))},e.pluginName="link",e}(n(3).PluginComponent);e.default=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(2),s=n(3),u=n(36),c=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboards=[],n.lastPop=null,n.handleChange=n.handleChange.bind(n),n.handleRedo=n.handleRedo.bind(n),n.handleUndo=n.handleUndo.bind(n),n.handleKeyboards=[{key:"y",keyCode:89,withKey:["ctrlKey"],callback:n.handleRedo},{key:"z",keyCode:90,withKey:["metaKey","shiftKey"],callback:n.handleRedo},{key:"z",keyCode:90,withKey:["ctrlKey"],callback:n.handleUndo},{key:"z",keyCode:90,withKey:["metaKey"],callback:n.handleUndo}],n.logger=new u.default,n}return r(e,t),e.prototype.handleUndo=function(){var t=this.logger.undo(this.editor.getMdValue());"undefined"!==typeof t&&(this.pause(),this.lastPop=t,this.editor.setText(t),this.forceUpdate())},e.prototype.handleRedo=function(){var t=this.logger.redo();"undefined"!==typeof t&&(this.lastPop=t,this.editor.setText(t),this.forceUpdate())},e.prototype.handleChange=function(t,e,n){var o=this;if(this.logger.getLast()!==t&&(null===this.lastPop||this.lastPop!==t)){if(this.logger.cleanRedo(),n)return this.logger.push(t),this.lastPop=null,void this.forceUpdate();this.timerId&&(window.clearTimeout(this.timerId),this.timerId=0),this.timerId=window.setTimeout((function(){o.logger.getLast()!==t&&(o.logger.push(t),o.lastPop=null,o.forceUpdate()),window.clearTimeout(o.timerId),o.timerId=0}),600)}},e.prototype.componentDidMount=function(){var t=this;this.editor.on("change",this.handleChange),this.handleKeyboards.forEach((function(e){return t.editor.onKeyboard(e)})),this.logger.initValue=this.editor.getMdValue(),this.forceUpdate()},e.prototype.componentWillUnmount=function(){var t=this;this.editor.off("change",this.handleChange),this.handleKeyboards.forEach((function(e){return t.editor.offKeyboard(e)}))},e.prototype.pause=function(){this.timerId&&(clearInterval(this.timerId),this.timerId=void 0)},e.prototype.render=function(){var t=this.logger.getUndoCount()>1||this.logger.initValue!==this.editor.getMdValue(),e=this.logger.getRedoCount()>0;return i.createElement(i.Fragment,null,i.createElement("span",{className:"button button-type-undo "+(t?"":"disabled"),title:l.default.get("btnUndo"),onClick:this.handleUndo},i.createElement(a.default,{type:"undo"})),i.createElement("span",{className:"button button-type-redo "+(e?"":"disabled"),title:l.default.get("btnRedo"),onClick:this.handleRedo},i.createElement(a.default,{type:"redo"})))},e.pluginName="logger",e}(s.PluginComponent);e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){this.record=[],this.recycle=[],this.initValue=""}return t.prototype.push=function(t){for(var e=this.record.push(t);this.record.length>100;)this.record.shift();return e},t.prototype.get=function(){return this.record},t.prototype.getLast=function(){var t=this.record.length;return this.record[t-1]},t.prototype.undo=function(t){var e=this.record.pop();if("undefined"===typeof e)return this.initValue;if(e!==t)return this.recycle.push(e),e;var n=this.record.pop();return"undefined"===typeof n?(this.recycle.push(e),this.initValue):(this.recycle.push(e),n)},t.prototype.redo=function(){var t=this.recycle.pop();if("undefined"!==typeof t)return this.push(t),t},t.prototype.cleanRedo=function(){this.recycle=[]},t.prototype.getUndoCount=function(){return this.undo.length},t.prototype.getRedoCount=function(){return this.recycle.length},t}();e.default=o},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,a=n(0),l=n(1),s=n(2),u=n(3);!function(t){t[t.SHOW_ALL=0]="SHOW_ALL",t[t.SHOW_MD=1]="SHOW_MD",t[t.SHOW_HTML=2]="SHOW_HTML"}(i||(i={}));var c=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n.handleChange=n.handleChange.bind(n),n.state={view:n.editor.getView()},n}return r(e,t),Object.defineProperty(e.prototype,"isDisplay",{get:function(){return!!this.editorConfig.canView&&(this.editorConfig.canView.html&&this.editorConfig.canView.md)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){var t=this.state.view;return t.html&&t.md?i.SHOW_MD:this.state.view.html?i.SHOW_ALL:i.SHOW_HTML},enumerable:!0,configurable:!0}),e.prototype.handleClick=function(){switch(this.next){case i.SHOW_ALL:this.editor.setView({html:!0,md:!0});break;case i.SHOW_HTML:this.editor.setView({html:!0,md:!1});break;case i.SHOW_MD:this.editor.setView({html:!1,md:!0})}},e.prototype.handleChange=function(t){this.setState({view:t})},e.prototype.componentDidMount=function(){this.editor.on("viewchange",this.handleChange)},e.prototype.componentWillUnmount=function(){this.editor.off("viewchange",this.handleChange)},e.prototype.getDisplayInfo=function(){switch(this.next){case i.SHOW_ALL:return{icon:"view-split",title:"All"};case i.SHOW_HTML:return{icon:"visibility",title:"Preview"};default:return{icon:"keyboard",title:"Editor"}}},e.prototype.render=function(){if(this.isDisplay){var t=this.getDisplayInfo();return a.createElement("span",{className:"button button-type-mode",title:s.default.get("btnMode"+t.title),onClick:this.handleClick},a.createElement(l.default,{type:t.icon}))}return null},e.pluginName="mode-toggle",e.align="right",e}(u.PluginComponent);e.default=c},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(6),l=n(1),s=n(2),u=n(3),c=n(39),d=function(t){function e(e){var n=t.call(this,e)||this;return n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.show=function(){this.setState({show:!0})},e.prototype.hide=function(){this.setState({show:!1})},e.prototype.render=function(){var t=this,e=this.editorConfig.table||{maxRow:6,maxCol:6};return i.createElement("span",{className:"button button-type-table",title:s.default.get("btnTable"),onMouseEnter:this.show,onMouseLeave:this.hide},i.createElement(l.default,{type:"grid"}),i.createElement(a.default,{show:this.state.show,onClose:this.hide},i.createElement(c.default,{visiblity:this.state.show,maxRow:e.maxRow,maxCol:e.maxCol,onSetTable:function(e){return t.editor.insertMarkdown("table",e)}})))},e.pluginName="table",e}(u.PluginComponent);e.default=d},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0);n(40);var a=function(t){function e(e){var n=t.call(this,e)||this;n.config={padding:3,width:20,height:20};var o=e.maxRow,r=void 0===o?5:o,i=e.maxCol,a=void 0===i?6:i;return n.state={maxRow:r,maxCol:a,list:n.formatTableModel(r,a)},n}return r(e,t),e.prototype.formatTableModel=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new Array(t).fill(void 0).map((function(t){return new Array(e).fill(0)}))},e.prototype.calcWrapStyle=function(){var t=this.state,e=t.maxRow,n=t.maxCol,o=this.config,r=o.width,i=o.height,a=o.padding;return{width:(r+a)*n-a+"px",height:(i+a)*e-a+"px"}},e.prototype.calcItemStyle=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var n=this.config,o=n.width,r=n.height,i=n.padding;return{top:(r+i)*t+"px",left:(o+i)*e+"px"}},e.prototype.getList=function(t,e){return this.state.list.map((function(n,o){return n.map((function(n,r){return o<=t&&r<=e?1:0}))}))},e.prototype.handleHover=function(t,e){this.setState({list:this.getList(t,e)})},e.prototype.handleSetTable=function(t,e){var n=this.props.onSetTable;"function"===typeof n&&n({row:t+1,col:e+1})},e.prototype.componentDidUpdate=function(t){!1===this.props.visiblity&&t.visiblity!==this.props.visiblity&&this.setState({list:this.getList(-1,-1)})},e.prototype.render=function(){var t=this;return i.createElement("ul",{className:"table-list wrap",style:this.calcWrapStyle()},this.state.list.map((function(e,n){return e.map((function(e,o){return i.createElement("li",{className:"list-item "+(1===e?"active":""),key:n+"-"+o,style:t.calcItemStyle(n,o),onMouseOver:t.handleHover.bind(t,n,o),onClick:t.handleSetTable.bind(t,n,o)})}))})))},e}(i.Component);e.default=a},function(t,e,n){}]);