通用评论

index.js.map 19KB

1
  1. {"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","onRef","setState","onChange","emoji","uid","path","files","length","forEach","push","OSS_LINK","item","canSubmit","beforeSubmit","text","onSubmit","placeholder","rows","showEmoji","closeUploadWhenBlur","maxUpload","btnSubmitText","btnLoading","btnDisabled","button","emojiToolIcon","imageToolIcon","disabledSubmit","e","target","width","zIndex","minHeight","margin","color","fontWeight","float","cursor","marginTop","React","cloneElement","onClick","marginLeft","showError","onError","Component","propTypes","PropTypes","number","string","bool","func","node","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;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;AACA,UAAKK,YAAL,GAAoB,MAAKA,YAAL,CAAkBL,IAAlB,OAApB;AACA,UAAKM,UAAL,GAAkB,MAAKA,UAAL,CAAgBN,IAAhB,OAAlB;AAfiB;AAgBlB;;;;wCAE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C,YAAU6C,oBAAUI,IARH;AASjBpC,YAAUgC,oBAAUI,IATH;AAUjBtC,gBAAckC,oBAAUI,IAVP;AAWjB9B,iBAAe0B,oBAAUE,MAXR;AAYjB3B,cAAYyB,oBAAUG,IAZL;AAajB3B,eAAawB,oBAAUG,IAbN;AAcjB1B,UAAQuB,oBAAUK,IAdD;AAejB3B,iBAAesB,oBAAUK,IAfR;AAgBjB1B,iBAAeqB,oBAAUK,IAhBR;AAiBjBT,aAAWI,oBAAUG,IAjBJ;AAkBjBN,WAASG,oBAAUI;AAlBF,CAAnB;;AAqBAlE,OAAOoE,YAAP,GAAsB;AACpBpC,QAAM,CADc;AAEpBD,eAAa,UAFO;AAGpBE,aAAW,IAHS;AAIpB9B,cAAY,IAJQ;AAKpB+B,uBAAqB,KALD;AAMpBC,aAAW,CANS;AAOpBC,iBAAe,IAPK;AAQpBC,cAAY,KARQ;AASpBC,eAAa,KATO;AAUpBoB,aAAW;AAVS,CAAtB;;kBAae1D,M","file":"index.js","sourcesContent":["import React from \"react\";\r\nimport PropTypes from \"prop-types\";\r\nimport { Icon, Button, Popover, Input } from \"antd\";\r\nimport { OSS_LINK } from \"../../constant\";\r\nimport { isFunction } from \"../../helper\";\r\nimport Upload from \"./Upload\";\r\nimport Emoji from \"./Emoji\";\r\nimport \"./index.css\";\r\n\r\nconst { TextArea } = Input;\r\n\r\nclass Editor extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n showUpload: false,\r\n value: \"\", // 编辑器里面的值\r\n\r\n fileList: [], // 图片列表\r\n fileMap: {} // 已经上传的图片路径和 uid 的映射 { uid: path }\r\n };\r\n this.handleChange = this.handleChange.bind(this);\r\n this.handleClickEmoji = this.handleClickEmoji.bind(this);\r\n this.handleChangeFileList = this.handleChangeFileList.bind(this);\r\n this.handleShowUpload = this.handleShowUpload.bind(this);\r\n this.handleUpload = this.handleUpload.bind(this);\r\n this.handleSubmit = this.handleSubmit.bind(this);\r\n this.resetState = this.resetState.bind(this);\r\n }\r\n\r\n componentDidMount() {\r\n if (isFunction(this.props.onRef)) {\r\n this.props.onRef(this);\r\n }\r\n }\r\n\r\n /**\r\n * 编辑器的值改变事件\r\n * 将最新的值存储到 state 中\r\n * @param {string} value 输入的值\r\n */\r\n handleChange(value) {\r\n this.setState({ value });\r\n if (this.props.onChange) {\r\n this.props.onChange(value);\r\n }\r\n }\r\n\r\n /**\r\n * 点击 emoji 的事件\r\n * 点击后,需要将改 emoji 插入到编辑器中\r\n * 插入的值为 [emoji chinese name]\r\n * 参数 emoji 即为 emoji chinese name\r\n * @param {string}} emoji emoji 的中文,如 微笑\r\n */\r\n handleClickEmoji(emoji) {\r\n let { value } = this.state;\r\n value += `[${emoji}]`;\r\n this.handleChange(value);\r\n }\r\n\r\n /**\r\n * 监听文件列表改变事件\r\n * @param {Array} fileList 文件列表\r\n */\r\n handleChangeFileList(fileList) {\r\n this.setState({ fileList });\r\n }\r\n\r\n /**\r\n * 控制上传 Popover 的显示和隐藏\r\n * @param {boolean} showUpload 是否显示上传的 Popover\r\n */\r\n handleShowUpload(showUpload) {\r\n if (typeof showUpload === \"boolean\") {\r\n this.setState({ showUpload: showUpload });\r\n } else {\r\n this.setState({ showUpload: !this.state.showUpload });\r\n }\r\n }\r\n\r\n /**\r\n * 上传文件\r\n * @param {object} param 文件对象\r\n */\r\n handleUpload({ uid, path }) {\r\n const { fileMap } = this.state;\r\n fileMap[uid] = path;\r\n this.setState({ fileMap });\r\n }\r\n\r\n /**\r\n * 提交编辑器内容\r\n * 提交功能,交给父组件来实现\r\n * 需要父组件传入 onSubmit\r\n */\r\n handleSubmit() {\r\n let { value, fileMap, fileList } = this.state;\r\n const files = [];\r\n if (fileList.length) {\r\n fileList.forEach(item => {\r\n files.push(`${OSS_LINK}${fileMap[item.uid]}`);\r\n });\r\n }\r\n let canSubmit = true;\r\n if (this.props.beforeSubmit) {\r\n canSubmit =\r\n this.props.beforeSubmit({ text: value, files }) === false\r\n ? false\r\n : true;\r\n }\r\n if (canSubmit) {\r\n this.props.onSubmit({ text: value, files }, () => {\r\n this.resetState();\r\n });\r\n }\r\n }\r\n\r\n resetState() {\r\n this.setState({\r\n showUpload: false,\r\n value: \"\",\r\n fileList: [],\r\n fileMap: {}\r\n });\r\n }\r\n\r\n render() {\r\n const {\r\n value,\r\n placeholder,\r\n rows,\r\n showEmoji,\r\n showUpload,\r\n closeUploadWhenBlur,\r\n maxUpload,\r\n btnSubmitText,\r\n btnLoading,\r\n btnDisabled,\r\n button,\r\n emojiToolIcon,\r\n imageToolIcon\r\n } = this.props;\r\n const handleSubmit = this.handleSubmit;\r\n const disabledSubmit =\r\n btnDisabled ||\r\n (!this.props.value && !this.state.value && !this.state.fileList.length);\r\n return (\r\n <div className=\"comment-editor\">\r\n <TextArea\r\n value={value || this.state.value}\r\n onChange={e => this.handleChange(e.target.value)}\r\n rows={rows}\r\n placeholder={placeholder}\r\n />\r\n\r\n <div className=\"comment-toolbar\">\r\n <div className=\"comment-toolbar-left\">\r\n {showEmoji && (\r\n <Popover\r\n trigger=\"click\"\r\n placement=\"bottomLeft\"\r\n autoAdjustOverflow={false}\r\n content={\r\n <div style={{ width: 200 }}>\r\n <Emoji onClick={this.handleClickEmoji} />\r\n </div>\r\n }\r\n overlayClassName=\"comment-emoji-popover\"\r\n >\r\n {emojiToolIcon || (\r\n <Icon type=\"smile-o\" className=\"comment-toolbar-icon\" />\r\n )}\r\n </Popover>\r\n )}\r\n\r\n {showUpload ? (\r\n closeUploadWhenBlur ? (\r\n <Popover\r\n trigger=\"click\"\r\n overlayStyle={{ zIndex: 999 }}\r\n content={\r\n <div\r\n style={{\r\n width: 112 * maxUpload,\r\n minHeight: 100,\r\n margin: \"0 auto\"\r\n }}\r\n >\r\n <Upload\r\n onChangeFileList={this.handleChangeFileList}\r\n onUpload={this.handleUpload}\r\n maxUpload={maxUpload}\r\n fileList={this.state.fileList}\r\n />\r\n </div>\r\n }\r\n placement=\"bottomLeft\"\r\n title={\r\n <div style={{ margin: \"5px auto\" }}>\r\n <span>\r\n 上传图片\r\n {maxUpload >= 2 ? (\r\n <span style={{ color: \"#666\", fontWeight: 400 }}>\r\n (您还能上传{maxUpload - this.state.fileList.length}张图片)\r\n </span>\r\n ) : null}\r\n </span>\r\n <Icon\r\n type=\"close\"\r\n onClick={() => this.handleShowUpload(false)}\r\n style={{\r\n float: \"right\",\r\n cursor: \"pointer\",\r\n marginTop: 4\r\n }}\r\n />\r\n </div>\r\n }\r\n >\r\n {imageToolIcon ? (\r\n React.cloneElement(imageToolIcon, {\r\n onClick: () => this.handleShowUpload(true)\r\n })\r\n ) : (\r\n <Icon\r\n type=\"picture\"\r\n className=\"comment-toolbar-icon\"\r\n style={{ marginLeft: 10 }}\r\n onClick={() => this.handleShowUpload(true)}\r\n />\r\n )}\r\n </Popover>\r\n ) : (\r\n <Popover\r\n visible={this.state.showUpload}\r\n overlayStyle={{ zIndex: 999 }}\r\n content={\r\n <div\r\n style={{\r\n width: 112 * maxUpload,\r\n minHeight: 100,\r\n margin: \"0 auto\"\r\n }}\r\n >\r\n <Upload\r\n onChangeFileList={this.handleChangeFileList}\r\n onUpload={this.handleUpload}\r\n maxUpload={maxUpload}\r\n fileList={this.state.fileList}\r\n showError={this.props.showError}\r\n onError={this.props.onError}\r\n />\r\n </div>\r\n }\r\n placement=\"bottomLeft\"\r\n title={\r\n <div style={{ margin: \"5px auto\" }}>\r\n <span>\r\n 上传图片\r\n {maxUpload >= 2 ? (\r\n <span style={{ color: \"#666\", fontWeight: 400 }}>\r\n (您还能上传{maxUpload - this.state.fileList.length}张图片)\r\n </span>\r\n ) : null}\r\n </span>\r\n <Icon\r\n type=\"close\"\r\n onClick={() => this.handleShowUpload(false)}\r\n style={{\r\n float: \"right\",\r\n cursor: \"pointer\",\r\n marginTop: 4\r\n }}\r\n />\r\n </div>\r\n }\r\n >\r\n {imageToolIcon ? (\r\n React.cloneElement(imageToolIcon, {\r\n onClick: () => this.handleShowUpload(true)\r\n })\r\n ) : (\r\n <Icon\r\n type=\"picture\"\r\n className=\"comment-toolbar-icon\"\r\n style={{ marginLeft: 10 }}\r\n onClick={() => this.handleShowUpload(true)}\r\n />\r\n )}\r\n </Popover>\r\n )\r\n ) : null}\r\n </div>\r\n\r\n <div className=\"comment-toolbar-right\">\r\n {button ? (\r\n React.cloneElement(button, {\r\n onClick: button.props.onClick || handleSubmit\r\n })\r\n ) : (\r\n <Button\r\n onClick={() => this.handleSubmit()}\r\n type=\"primary\"\r\n loading={btnLoading}\r\n disabled={disabledSubmit}\r\n >\r\n {btnSubmitText}\r\n </Button>\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n }\r\n}\r\n\r\nEditor.propTypes = {\r\n rows: PropTypes.number,\r\n placeholder: PropTypes.string,\r\n showEmoji: PropTypes.bool,\r\n showUpload: PropTypes.bool,\r\n closeUploadWhenBlur: PropTypes.bool,\r\n maxUpload: PropTypes.number,\r\n value: PropTypes.string,\r\n onChange: PropTypes.func,\r\n onSubmit: PropTypes.func,\r\n beforeSubmit: PropTypes.func,\r\n btnSubmitText: PropTypes.string,\r\n btnLoading: PropTypes.bool,\r\n btnDisabled: PropTypes.bool,\r\n button: PropTypes.node,\r\n emojiToolIcon: PropTypes.node,\r\n imageToolIcon: PropTypes.node,\r\n showError: PropTypes.bool,\r\n onError: PropTypes.func,\r\n};\r\n\r\nEditor.defaultProps = {\r\n rows: 5,\r\n placeholder: \"说点什么吧...\",\r\n showEmoji: true,\r\n showUpload: true,\r\n closeUploadWhenBlur: false,\r\n maxUpload: 1,\r\n btnSubmitText: \"发表\",\r\n btnLoading: false,\r\n btnDisabled: false,\r\n showError: true\r\n};\r\n\r\nexport default Editor;\r\n"]}