1 |
- {"version":3,"sources":["../src/index.js"],"names":["Index","props","state","fileList","uid","name","status","response","url","editorProps","setState","React","Component","renderComment","config","id","Error","type","businessId","console","warn","API","ReactDOM","render","document","getElementById","window","process","env","NODE_ENV","businessUserId","userId","onCountChange","log","c"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;;;;;;;;;AACA;;IAEMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,gBAAU,CACR;AACEC,aAAK,GADP;AAEEC,cAAM,SAFR;AAGEC,gBAAQ,MAHV;AAIEC,kBAAU,SAJZ,EAIuB;AACrBC,aACE;AANJ,OADQ;AADC,KAAb;AAFiB;AAclB;;;;6BAEQ;AAAA;;AACP,aACE;AAAC,qBAAD;AAAA;AACE,gCADF;AAEE,8BAFF;AAGE,8BAHF;AAIE;AAJF,WAKM,KAAKP,KALX;AAOE,sCAAC,WAAD;AACE,qBAAW,CADb;AAEE;AAFF,WAGM,KAAKA,KAAL,CAAWQ,WAHjB;AAIE,oBAAU,KAAKP,KAAL,CAAWC,QAJvB;AAKE,gCAAsB,wCAAY;AAChC,mBAAKO,QAAL,CAAc;AACZP;AADY,aAAd;AAGD;AATH;AAPF,OADF;AAqBD;;;;EAvCiBQ,gBAAMC,S;;AA0C1B;;;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOG,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOI,UAAZ,EAAwB;AACtB;AACAJ,WAAOI,UAAP,GAAoB,MAApB;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAP,WAAOO,GAAP,GAAa,oCAAb;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;;AAEDE,qBAASC,MAAT,CAAgB,8BAAC,KAAD,EAAWT,MAAX,CAAhB,EAAuCU,SAASC,cAAT,CAAwBX,OAAOC,EAA/B,CAAvC;AACA;AACD;;AAEDW,OAAOb,aAAP,GAAuBA,aAAvB;;AAEA,IAAIc,QAAQC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzChB,gBAAc;AACZE,QAAI,cADQ;AAEZE,UAAM,CAFM;AAGZC,gBAAY,MAHA;AAIZY,oBAAgB,CAJJ;AAKZC,YAAQ,KALI;AAMZC,mBAAe,0BAAK;AAClBb,cAAQc,GAAR,CAAYC,CAAZ;AACD,KARW;AASZzB,iBAAa;AACX;AACA;AAFW;AATD,GAAd;AAcD;;AAED;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App, { Editor } from \"./App\";\n// import registerServiceWorker from \"./registerServiceWorker\";\n\nclass Index extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n fileList: [\n {\n uid: \"1\",\n name: \"xxx.png\",\n status: \"done\",\n response: \"success\", // custom error message to show\n url:\n \"//links-comment.oss-cn-beijing.aliyuncs.com/comment/20190617/UCs7aXEjW.jpeg\"\n }\n ]\n };\n }\n\n render() {\n return (\n <App\n showAlertComment\n showAlertReply\n showAlertFavor\n showError\n {...this.props}\n >\n <Editor\n maxUpload={9}\n autoFocus\n {...this.props.editorProps}\n fileList={this.state.fileList}\n handleChangeFileList={fileList => {\n this.setState({\n fileList\n });\n }}\n />\n </App>\n );\n }\n}\n\n/**\n * 渲染评论组件\n * @param {object} config 编辑器配置\n * - {string} id 渲染评论的DOM的 ID\n * - {number} type 评论的 type\n * - {string} businessId 评论的 businessId\n * - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\n */\nfunction renderComment(config) {\n if (!config.id) {\n throw new Error(\"id is required\");\n }\n if (!config.type) {\n throw new Error(\"type is required\");\n }\n if (!config.businessId) {\n // throw new Error(\"businessId is required\");\n config.businessId = \"test\";\n console.warn(\"没有传入 businessId 参数,默认使用: test\");\n }\n if (!config.API) {\n // throw new Error(\"API is required\");\n config.API = \"http://api.links123.net/comment/v1\";\n console.warn(\n \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\n );\n }\n\n ReactDOM.render(<Index {...config} />, document.getElementById(config.id));\n // registerServiceWorker();\n}\n\nwindow.renderComment = renderComment;\n\nif (process.env.NODE_ENV !== \"production\") {\n renderComment({\n id: \"root-comment\",\n type: 1,\n businessId: \"test\",\n businessUserId: 4,\n userId: 71299,\n onCountChange: c => {\n console.log(c);\n },\n editorProps: {\n // emojiPopoverPlacement: \"bottom\",\n // uploadPopoverPlacement: \"top\"\n }\n });\n}\n\n// renderComment({\n// id: \"root-comment\",\n// type: 1,\n// businessId: \"test\",\n// API: 'http://api.links123.net/comment/v1',\n// });\n"]}
|