1 |
- {"version":3,"sources":["../src/index.js"],"names":["Index","props","state","value","handleChangeValue","bind","handleChangeSubmit","setState","console","log","text","files","loading","setTimeout","msg","response","status","Promise","resolve","Component","ReactDOM","render","document","getElementById"],"mappings":";;;;AAAA;;;;AACA;;;;AAIA;;;;AACA;;;;;;;;;;;AAJA;AACA;AACA;;;IAIMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,aAAO;AADI,KAAb;AAGA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBC,IAAvB,OAAzB;AACA,UAAKC,kBAAL,GAA0B,MAAKA,kBAAL,CAAwBD,IAAxB,OAA1B;AANiB;AAOlB;;;;sCAEiBF,K,EAAO;AACvB,WAAKI,QAAL,CAAc,EAAEJ,YAAF,EAAd;AACAK,cAAQC,GAAR,CAAY,2BAAZ,EAAyCN,KAAzC;AACD;;;6CAEmC;AAAA;;AAAA,UAAfO,IAAe,QAAfA,IAAe;AAAA,UAATC,KAAS,QAATA,KAAS;;AAClC,WAAKJ,QAAL,CAAc,EAAEK,SAAS,IAAX,EAAd,EAAiC,YAAM;AACrCC,mBAAW,YAAM;AACf,iBAAKN,QAAL,CAAc,EAAEK,SAAS,KAAX,EAAd;AACD,SAFD,EAEG,IAFH;AAGD,OAJD;AAKAJ,cAAQC,GAAR,CAAY,eAAZ,EAA6BC,IAA7B;AACAF,cAAQC,GAAR,CAAY,gBAAZ,EAA8BE,KAA9B;AACD;;;6BAEQ;AACP;AACA,aACE;AAAC,qBAAD;AAAA;AACE,gBAAM,CADR;AAEE,sBAAW,MAFb;AAGE,gCAHF;AAIE,8BAJF;AAKE,8BALF;AAME,qBAAW,KANb;AAOE,kBAAQ,KAPV;AAQE,mBAAS,iBAACG,GAAD,SAAuB;AAAA,gBAAfC,QAAe,SAAfA,QAAe;;AAC9B,gBAAIA,SAASC,MAAT,KAAoB,GAAxB,EAA6B;AAC3BR,sBAAQC,GAAR,CAAY,WAAZ;AACD;AACDD,oBAAQC,GAAR,iBAA0BK,GAA1B;AACD;AAbH;AAeE,sCAAC,WAAD;AACE,qBAAW,CADb;AAEE,wBAAc,wBAAM;AAClB,mBAAO,IAAIG,OAAJ,CAAY,mBAAW;AAC5BC,sBAAQ,IAAR;AACD,aAFM,CAAP;AAGD,WANH;AAOE,4BAAkB,4BAAM;AACtBV,oBAAQC,GAAR,CAAY,MAAZ;AACD,WATH;AAUE,qBAAW,KAVb;AAWE,mBAAS,iBAACK,GAAD,SAAuB;AAAA,gBAAfC,QAAe,SAAfA,QAAe;;AAC9B,gBAAIA,SAASC,MAAT,KAAoB,GAAxB,EAA6B;AAC3BR,sBAAQC,GAAR,CAAY,WAAZ;AACD;AACDD,oBAAQC,GAAR,iBAA0BK,GAA1B;AACD;AAhBH;AAfF,OADF;;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACD;;;;EAvGiBK,gB;;AA0GpBC,mBAASC,MAAT,CAAgB,8BAAC,KAAD,OAAhB,EAA2BC,SAASC,cAAT,CAAwB,cAAxB,CAA3B;AACA","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\n// e.g.\r\n// import { Button, Icon } from \"antd\";\r\n// import App, { Editor, RenderText } from \"./App\";\r\nimport App, { Editor } from \"./App\";\r\nimport registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nclass Index extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n value: \"\"\r\n };\r\n this.handleChangeValue = this.handleChangeValue.bind(this);\r\n this.handleChangeSubmit = this.handleChangeSubmit.bind(this);\r\n }\r\n\r\n handleChangeValue(value) {\r\n this.setState({ value });\r\n console.log(\"handleChangeValue value: \", value);\r\n }\r\n\r\n handleChangeSubmit({ text, files }) {\r\n this.setState({ loading: true }, () => {\r\n setTimeout(() => {\r\n this.setState({ loading: false });\r\n }, 2000);\r\n });\r\n console.log(\"submit text: \", text);\r\n console.log(\"submit files: \", files);\r\n }\r\n\r\n render() {\r\n // 最简单的用法\r\n return (\r\n <App\r\n type={1}\r\n businessId=\"test\"\r\n showAlertComment\r\n showAlertReply\r\n showAlertFavor\r\n showError={false}\r\n userId={71299}\r\n onError={(msg, { response }) => {\r\n if (response.status === 401) {\r\n console.log(\"unlogined\")\r\n }\r\n console.log(`-----------${msg}`);\r\n }}\r\n >\r\n <Editor\r\n maxUpload={4}\r\n beforeSubmit={() => {\r\n return new Promise(resolve => {\r\n resolve(true);\r\n });\r\n }}\r\n onCommentSuccess={() => {\r\n console.log(\"succ\");\r\n }}\r\n showError={false}\r\n onError={(msg, { response }) => {\r\n if (response.status === 401) {\r\n console.log(\"unlogined\")\r\n }\r\n console.log(`-----------${msg}`);\r\n }}\r\n />\r\n </App>\r\n );\r\n\r\n // e.g.\r\n // 复杂的用户法\r\n // const props = {\r\n // type: 1,\r\n // businessId: \"1\",\r\n // API: \"http://api.links123.net/comment/v1\",\r\n // showList: true\r\n // };\r\n\r\n // const editorProps = {\r\n // showEmoji: true,\r\n // placeholder: \"说点什么吧\",\r\n // rows: 5,\r\n // btnLoading: this.state.loading,\r\n // btnDisable: this.state.loading,\r\n // btnSubmitText: \"提交\",\r\n // value: this.state.value,\r\n // onChange: v => this.handleChangeValue(v),\r\n // onSubmit: v => this.handleChangeSubmit(v),\r\n // button: (\r\n // <Button\r\n // type=\"primary\"\r\n // ghost\r\n // // onClick={() => console.log('click btn: ', this.state.value)}\r\n // >\r\n // 自定义按钮\r\n // </Button>\r\n // ),\r\n // emojiToolIcon: <Icon type=\"smile\" style={{ fontSize: 23 }} />,\r\n // imageToolIcon: (\r\n // <Icon type=\"cloud-upload-o\" style={{ fontSize: 25, marginLeft: 10 }} />\r\n // )\r\n // };\r\n\r\n // return (\r\n // <App {...props}>\r\n // <Editor {...editorProps} />\r\n // </App>\r\n // );\r\n }\r\n}\r\n\r\nReactDOM.render(<Index />, document.getElementById(\"root-comment\"));\r\nregisterServiceWorker();\r\n"]}
|