通用评论

1
  1. {"version":3,"sources":["../../../src/components/Editor/index.js"],"names":["TextArea","Editor","props","state","showUpload","handleClickEmoji","bind","handleShowUpload","emojiId","onChangeEmoji","setState","value","onChange","placeholder","fileList","onChangeFileList","onUpload","float","margin","width","zIndex","MAX_UPLOAD_NUMBER","minHeight","color","fontWeight","length","cursor","marginTop","marginLeft","onSubmit","loading","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;;AAEA;;AACA;;;;AACA;;;;AAEA;;;;;;;;+eAPA;;AAMA;;;IAGQA,Q,mBAAAA,Q;;IAEaC,M;;;AACnB,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA,gHACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,kBAAY;AADD,KAAb;AAGA,UAAKC,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBC,IAAtB,OAAxB;AACA,UAAKC,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBD,IAAtB,OAAxB;AANiB;AAOlB;;;;wCAEmB,CAAE;;;qCAELE,O,EAAS;AACxB,WAAKN,KAAL,CAAWO,aAAX,CAAyBD,OAAzB;AACD;;;qCAEgBJ,U,EAAY;AAC3B,UAAI,OAAOA,UAAP,KAAsB,SAA1B,EAAqC;AACnC,aAAKM,QAAL,CAAc,EAAEN,YAAYA,UAAd,EAAd;AACD,OAFD,MAEO;AACL,aAAKM,QAAL,CAAc,EAAEN,YAAY,CAAC,KAAKD,KAAL,CAAWC,UAA1B,EAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,mBAQH,KAAKF,KARF;AAAA,UAELS,KAFK,UAELA,KAFK;AAAA,UAGLC,QAHK,UAGLA,QAHK;AAAA,UAILC,WAJK,UAILA,WAJK;AAAA,UAKLC,QALK,UAKLA,QALK;AAAA,UAMLC,gBANK,UAMLA,gBANK;AAAA,UAOLC,QAPK,UAOLA,QAPK;;AASP,aACE;AAAA;AAAA,UAAK,WAAU,QAAf;AACE,sCAAC,QAA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,MAFZ;AAGE,uBAAO,EAAEC,YAAY,EAAd,EAHT;AAIE,yBAAS;AAAA,yBAAM,OAAKrB,gBAAL,CAAsB,IAAtB,CAAN;AAAA;AAJX;AAjCF;AAfF,WADF;AA0DE;AAAA;AAAA,cAAK,OAAO,EAAEU,OAAO,OAAT,EAAkBC,QAAQ,UAA1B,EAAZ;AACE;AAAA;AAAA;AACE,yBAAS,KAAKhB,KAAL,CAAW2B,QADtB;AAEE,sBAAK,SAFP;AAGE,yBAAS,KAAK3B,KAAL,CAAW4B;AAHtB;AAAA;AAAA;AADF;AA1DF;AARF,OADF;AA+ED;;;;EAhHiCC,gBAAMC,S;;kBAArB/B,M","file":"index.js","sourcesContent":["// https://github.com/lovasoa/react-contenteditable/blob/master/src/react-contenteditable.js\nimport React from \"react\";\nimport { Icon, Button, Popover, Input } from \"antd\";\nimport { MAX_UPLOAD_NUMBER } from \"../../constant\";\nimport Upload from \"./Upload\";\nimport Emoji from \"./Emoji\";\n// import styles from \"./index.less\";\nimport \"./index.css\";\n\nconst { TextArea } = Input;\n\nexport default class Editor extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n showUpload: false\n };\n this.handleClickEmoji = this.handleClickEmoji.bind(this);\n this.handleShowUpload = this.handleShowUpload.bind(this);\n }\n\n componentDidMount() {}\n\n handleClickEmoji(emojiId) {\n this.props.onChangeEmoji(emojiId);\n }\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 render() {\n const {\n value,\n onChange,\n placeholder,\n fileList,\n onChangeFileList,\n onUpload\n } = this.props;\n return (\n <div className=\"editor\">\n <TextArea\n value={value}\n onChange={onChange}\n rows={5}\n placeholder={placeholder}\n />\n\n <div className=\"toolbar\">\n <div style={{ float: \"left\", margin: \"8px 11px\" }}>\n <Popover\n trigger=\"click\"\n placement=\"bottomLeft\"\n autoAdjustOverflow={false}\n content={\n <div style={{ width: 200 }}>\n <Emoji onClick={this.handleClickEmoji} />\n </div>\n }\n overlayClassName=\"feed\"\n >\n <Icon type=\"smile-o\" className=\"icon\" />\n </Popover>\n\n <Popover\n visible={this.state.showUpload}\n overlayStyle={{ zIndex: 999 }}\n content={\n <div style={{ width: 112 * MAX_UPLOAD_NUMBER, minHeight: 100 }}>\n <Upload\n onChangeFileList={onChangeFileList}\n onUpload={onUpload}\n fileList={fileList}\n />\n </div>\n }\n placement=\"bottomLeft\"\n title={\n <div style={{ margin: \"5px auto\" }}>\n <span>\n 上传图片\n <span style={{ color: \"#666\", fontWeight: 400 }}>\n (您还能上传{MAX_UPLOAD_NUMBER - fileList.length}张图片)\n </span>\n </span>\n <Icon\n type=\"close\"\n onClick={() => this.handleShowUpload(false)}\n style={{\n float: \"right\",\n cursor: \"pointer\",\n marginTop: 4\n }}\n />\n </div>\n }\n >\n <Icon\n type=\"picture\"\n className=\"icon\"\n style={{ marginLeft: 10 }}\n onClick={() => this.handleShowUpload(true)}\n />\n </Popover>\n </div>\n\n <div style={{ float: \"right\", margin: \"5px 11px\" }}>\n <Button\n onClick={this.props.onSubmit}\n type=\"primary\"\n loading={this.props.loading}\n >\n 发表\n </Button>\n </div>\n </div>\n </div>\n );\n }\n}\n"]}