{"version":3,"sources":["../../../src/components/Editor/index.js"],"names":["TextArea","Editor","props","state","showUpload","value","fileList","fileMap","handleChange","bind","handleClickEmoji","handleChangeFileList","handleShowUpload","handleUpload","handleSubmit","resetState","handleEmojiScroll","onRef","e","emoji","preventDefault","deltaY","next","prev","setState","onChange","list","length","maxUpload","slice","uid","path","map","item","thumbUrl","OSS_LINK","maxLength","error","intl","get","files","forEach","url","push","beforeSubmit","Promise","resolve","text","then","res","onSubmit","onCommentSuccess","rows","showEmoji","multiple","emojiPopoverPlacement","uploadPopoverPlacement","uploadOverlayClassName","closeUploadWhenBlur","btnLoading","btnDisabled","button","emojiToolIcon","imageToolIcon","autoFocus","placeholder","btnSubmitText","disabledSubmit","inputValue","uploadFileList","target","zIndex","width","height","node","visible","minHeight","margin","showError","onError","color","fontWeight","count","React","cloneElement","onClick","marginLeft","Component","propTypes","PropTypes","number","string","bool","func","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;;;AACA;;;;AACA;;AACA;;AACA;;;;AACA;;;;AACA;;;;;;;;;;IAEQA,Q,mBAAAA,Q;;IAEFC,M;;;AACJ,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA,gHACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,kBAAY,KADD;AAEXC,aAAO,EAFI,EAEA;;AAEXC,gBAAU,EAJC,EAIG;AACdC,eAAS,EALE,CAKC;AALD,KAAb;AAOA,UAAKC,YAAL,GAAoB,MAAKA,YAAL,CAAkBC,IAAlB,OAApB;AACA,UAAKC,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBD,IAAtB,OAAxB;AACA,UAAKE,oBAAL,GAA4B,MAAKA,oBAAL,CAA0BF,IAA1B,OAA5B;AACA,UAAKG,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBH,IAAtB,OAAxB;AACA,UAAKI,YAAL,GAAoB,MAAKA,YAAL,CAAkBJ,IAAlB,OAApB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V3BtF,OAAOuF,SAAP,GAAmB;AACjBpC,QAAMqC,oBAAUC,MADC;AAEjBzB,eAAawB,oBAAUE,MAFN;AAGjBtC,aAAWoC,oBAAUG,IAHJ;AAIjBrC,yBAAuBkC,oBAAUE,MAJhB;AAKjBvF,cAAYqF,oBAAUG,IALL;AAMjBpC,0BAAwBiC,oBAAUE,MANjB;AAOjBlC,0BAAwBgC,oBAAUE,MAPjB;AAQjBrC,YAAUmC,oBAAUG,IARH;AASjBlC,uBAAqB+B,oBAAUG,IATd;AAUjBhE,aAAW6D,oBAAUC,MAVJ;AAWjBrF,SAAOoF,oBAAUE,MAXA;AAYjBlE,YAAUgE,oBAAUI,IAZH;AAajB3C,YAAUuC,oBAAUI,IAbH;AAcjBjD,gBAAc6C,oBAAUI,IAdP;AAejB3B,iBAAeuB,oBAAUE,MAfR;AAgBjBhC,cAAY8B,oBAAUG,IAhBL;AAiBjBhC,eAAa6B,oBAAUG,IAjBN;AAkBjB/B,UAAQ4B,oBAAUf,IAlBD;AAmBjBZ,iBAAe2B,oBAAUf,IAnBR;AAoBjBX,iBAAe0B,oBAAUf,IApBR;AAqBjBI,aAAWW,oBAAUG,IArBJ;AAsBjBb,WAASU,oBAAUI,IAtBF;AAuBjBzD,aAAWqD,oBAAUC;AAvBJ,CAAnB;;AA0BAzF,OAAO6F,YAAP,GAAsB;AACpB1C,QAAM,CADc;AAEpB;AACAC,aAAW,IAHS;AAIpBjD,cAAY,IAJQ;AAKpBkD,YAAU,IALU;AAMpBC,yBAAuB,YANH;AAOpBG,uBAAqB,KAPD;AAQpBF,0BAAwB,YARJ;AASpBC,0BAAwB,EATJ;AAUpB7B,aAAW,CAVS;AAWpB;AACA+B,cAAY,KAZQ;AAapBC,eAAa,KAbO;AAcpBkB,aAAW,IAdS;AAepB1C,aAAW;AAfS,CAAtB;;kBAkBenC,M","file":"index.js","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Icon, Button, Popover, Input, message } from \"antd\";\nimport classnames from \"classnames\";\nimport intl from \"react-intl-universal\";\nimport { OSS_LINK } from \"../../constant\";\nimport { isFunction } from \"../../helper\";\nimport Upload from \"./Upload\";\nimport Emoji from \"./Emoji\";\nimport \"./index.css\";\n\nconst { TextArea } = Input;\n\nclass Editor extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n showUpload: false,\n value: \"\", // 编辑器里面的值\n\n fileList: [], // 图片列表\n fileMap: {} // 已经上传的图片路径和 uid 的映射 { uid: path }\n };\n this.handleChange = this.handleChange.bind(this);\n this.handleClickEmoji = this.handleClickEmoji.bind(this);\n this.handleChangeFileList = this.handleChangeFileList.bind(this);\n this.handleShowUpload = this.handleShowUpload.bind(this);\n this.handleUpload = this.handleUpload.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.resetState = this.resetState.bind(this);\n this.handleEmojiScroll = this.handleEmojiScroll.bind(this);\n }\n\n componentDidMount() {\n if (isFunction(this.props.onRef)) {\n this.props.onRef(this);\n }\n }\n\n handleEmojiScroll(e) {\n if (!this.emoji) {\n return;\n }\n e.preventDefault();\n if (e.deltaY > 0) {\n this.emoji.next();\n } else if (e.deltaY < 0) {\n this.emoji.prev();\n }\n }\n\n /**\n * 编辑器的值改变事件\n * 将最新的值存储到 state 中\n * @param {string} value 输入的值\n */\n handleChange(value) {\n this.setState({ value });\n if (this.props.onChange) {\n this.props.onChange(value);\n }\n }\n\n /**\n * 点击 emoji 的事件\n * 点击后,需要将改 emoji 插入到编辑器中\n * 插入的值为 [emoji chinese name]\n * 参数 emoji 即为 emoji chinese name\n * @param {string}} emoji emoji 的中文,如 微笑\n */\n handleClickEmoji(emoji) {\n let value = this.props.value || this.state.value;\n value += `[${emoji}]`;\n this.handleChange(value);\n }\n\n /**\n * 监听文件列表改变事件\n * @param {Array} fileList 文件列表\n */\n handleChangeFileList(fileList) {\n let list = fileList;\n if (fileList.length > this.props.maxUpload) {\n list = fileList.slice(0, this.props.maxUpload);\n }\n this.props.handleChangeFileList(list);\n this.setState({ fileList: list });\n }\n\n /**\n * 控制上传 Popover 的显示和隐藏\n * @param {boolean} showUpload 是否显示上传的 Popover\n */\n handleShowUpload(showUpload) {\n if (typeof showUpload === \"boolean\") {\n this.setState({ showUpload: showUpload });\n } else {\n this.setState({ showUpload: !this.state.showUpload });\n }\n }\n\n /**\n * 上传文件\n * @param {object} param 文件对象\n */\n handleUpload({ uid, path }) {\n const { fileMap } = this.state;\n let { fileList } = this.state;\n fileMap[uid] = path;\n fileList = fileList.map(item => {\n if (item.uid === uid) {\n item.thumbUrl = OSS_LINK + path;\n }\n return item;\n });\n this.props.handleChangeFileList(fileList);\n this.setState({ fileMap, fileList });\n }\n\n /**\n * 提交编辑器内容\n * 提交功能,交给父组件来实现\n * 需要父组件传入 onSubmit\n */\n handleSubmit() {\n const { maxLength } = this.props;\n let { value, fileMap, fileList } = this.state;\n if (value.length > maxLength) {\n // message.error(`字数不得超过${maxLength}字`);\n message.error(intl.get(\"editor.maxLength\", { maxLength }));\n return;\n }\n const files = [];\n if (fileList.length) {\n fileList.forEach(item => {\n if (item.url) {\n files.push(item.url);\n return;\n }\n if (!fileMap[item.uid]) {\n return;\n }\n files.push(`${OSS_LINK}${fileMap[item.uid]}`);\n });\n }\n if (this.props.beforeSubmit) {\n Promise.resolve(this.props.beforeSubmit({ text: value, files })).then(\n res => {\n if (!(res === false)) {\n this.props.onSubmit({ text: value, files }, res => {\n this.resetState();\n if (this.props.onCommentSuccess) {\n this.props.onCommentSuccess(res);\n }\n });\n }\n }\n );\n } else {\n this.props.onSubmit({ text: value, files }, res => {\n this.resetState();\n if (this.props.onCommentSuccess) {\n this.props.onCommentSuccess(res);\n }\n });\n }\n }\n\n resetState() {\n this.setState({\n showUpload: false,\n value: \"\",\n fileList: [],\n fileMap: {}\n });\n }\n\n render() {\n const {\n value,\n // placeholder,\n rows,\n showEmoji,\n showUpload,\n multiple,\n emojiPopoverPlacement,\n uploadPopoverPlacement,\n uploadOverlayClassName,\n fileList,\n closeUploadWhenBlur,\n maxUpload,\n // btnSubmitText,\n btnLoading,\n btnDisabled,\n button,\n emojiToolIcon,\n imageToolIcon,\n maxLength,\n autoFocus\n } = this.props;\n let placeholder = this.props.placeholder || intl.get(\"editor.placeholder\");\n let btnSubmitText =\n this.props.btnSubmitText || intl.get(\"editor.SubmitBtn\");\n const handleSubmit = this.handleSubmit;\n const disabledSubmit =\n btnDisabled ||\n (!this.props.value && !this.state.value && !this.state.fileList.length);\n const inputValue = value || this.state.value;\n const uploadFileList = fileList || this.state.fileList;\n return (\n
\n maxLength\n })}\n >\n {/* {intl.get(\"editor.alreadyEntered\", {\n count: inputValue.length,\n maxLength\n })} */}\n
\n
\n this.handleChange(e.target.value)}\n rows={rows}\n placeholder={placeholder}\n autoFocus={autoFocus}\n />\n\n
\n
\n {showEmoji && (\n \n {\n this.emoji = node;\n }}\n />\n
\n }\n overlayClassName=\"comment-emoji-popover\"\n >\n {emojiToolIcon || (\n \n )}\n \n )}\n\n {showUpload ? (\n {\n this.handleShowUpload(visible);\n }\n : null\n }\n content={\n \n \n
\n
\n }\n title={\n
\n \n {intl.get(\"editor.uploadTip\")}\n {maxUpload >= 2 ? (\n \n {intl.get(\"editor.uploadCount\", {\n count: maxUpload - uploadFileList.length\n })}\n \n ) : null}\n \n {/* 因为是点击别的区域关闭,所以不用右上角的 Icon */}\n {/* this.handleShowUpload(false)}\n style={{\n float: \"right\",\n cursor: \"pointer\",\n marginTop: 4\n }}\n /> */}\n
\n }\n >\n {imageToolIcon ? (\n React.cloneElement(imageToolIcon, {\n onClick: () => this.handleShowUpload(true)\n })\n ) : (\n this.handleShowUpload(true)}\n />\n )}\n \n ) : null}\n
\n\n
\n {button ? (\n React.cloneElement(button, {\n onClick: button.props.onClick || handleSubmit\n })\n ) : (\n this.handleSubmit()}\n type=\"primary\"\n loading={btnLoading}\n disabled={disabledSubmit}\n >\n {btnSubmitText}\n \n )}\n
\n
\n \n \n );\n }\n}\n\nEditor.propTypes = {\n rows: PropTypes.number,\n placeholder: PropTypes.string,\n showEmoji: PropTypes.bool,\n emojiPopoverPlacement: PropTypes.string,\n showUpload: PropTypes.bool,\n uploadPopoverPlacement: PropTypes.string,\n uploadOverlayClassName: PropTypes.string,\n multiple: PropTypes.bool,\n closeUploadWhenBlur: PropTypes.bool,\n maxUpload: PropTypes.number,\n value: PropTypes.string,\n onChange: PropTypes.func,\n onSubmit: PropTypes.func,\n beforeSubmit: PropTypes.func,\n btnSubmitText: PropTypes.string,\n btnLoading: PropTypes.bool,\n btnDisabled: PropTypes.bool,\n button: PropTypes.node,\n emojiToolIcon: PropTypes.node,\n imageToolIcon: PropTypes.node,\n showError: PropTypes.bool,\n onError: PropTypes.func,\n maxLength: PropTypes.number\n};\n\nEditor.defaultProps = {\n rows: 5,\n // placeholder: \"说点什么吧\",\n showEmoji: true,\n showUpload: true,\n multiple: true,\n emojiPopoverPlacement: \"bottomLeft\",\n closeUploadWhenBlur: false,\n uploadPopoverPlacement: \"bottomLeft\",\n uploadOverlayClassName: \"\",\n maxUpload: 1,\n // btnSubmitText: \"发表\",\n btnLoading: false,\n btnDisabled: false,\n showError: true,\n maxLength: 5000\n};\n\nexport default Editor;\n"]}