通用评论

index.js.map 7.1KB

1
  1. {"version":3,"sources":["../src/index.js"],"names":["Index","props","state","fileList","value","editorProps","setState","console","log","React","Component","renderComment","config","id","Error","type","businessId","warn","API","ReactDOM","render","document","getElementById","window","process","env","NODE_ENV","businessUserId","userId","currentUser","user_id","userAvaHoverData","nickname","followers","fans","isFollowed","showHoverCard","showEdit","userAvaClick","getUserInfo","focus","Promise","resolve","reject","unFocus","onCountChange","c","onDelete","data","onUpdateComment","onBeforeUpdateComment","onCommentSuccess"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;;;;;;;;;AACA;;IAEMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,gBAAU;AACR;AACA;AACA;AACA;AACA;AACA;AANQ,OADC;AASXC,aAAO;AATI,KAAb;AAFiB;AAalB;;;;6BAEQ;AAAA;;AACP,aACE;AAAC,qBAAD;AAAA;AACE,gCADF;AAEE,8BAFF;AAGE,8BAHF;AAIE;AAJF,WAKM,KAAKH,KALX;AAOE,sCAAC,WAAD;AACE,qBAAW,CADb;AAEE;AAFF,WAGM,KAAKA,KAAL,CAAWI,WAHjB;AAIE,oBAAU,KAAKH,KAAL,CAAWC,QAJvB;AAKE,iBAAO,KAAKD,KAAL,CAAWE,KALpB;AAME,oBAAU,yBAAS;AACjB,mBAAKE,QAAL,CAAc;AACZF;AADY,aAAd;AAGD,WAVH;AAWE,gCAAsB,wCAAY;AAChCG,oBAAQC,GAAR,CAAY,MAAZ,EAAoBL,QAApB;AACA,mBAAKG,QAAL,CAAc;AACZH;AADY,aAAd;AAGD;AAhBH;AAPF,OADF;AA4BD;;;;EA7CiBM,gBAAMC,S;;AAgD1B;;;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MA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AO,IAAIC,OAAJ,CAAY,UAASC,OAAT,EAAkBC,MAAlB,EAA0B;AAC3CpC,gBAAQC,GAAR,CAAY,QAAZ,EAAsBK,EAAtB;AACA6B;AACD,OAHM,CAAP;AAID,KA1CW;AA2CZE,aAAS,qBAAM;AACb,aAAO,IAAIH,OAAJ,CAAY,UAASC,OAAT,EAAkBC,MAAlB,EAA0B;AAC3CpC,gBAAQC,GAAR,CAAY,UAAZ,EAAwBK,EAAxB;AACA6B;AACD,OAHM,CAAP;AAID,KAhDW;AAiDZG,mBAAe,0BAAK;AAClBtC,cAAQC,GAAR,CAAYsC,CAAZ;AACD,KAnDW;AAoDZC,cAAU,kBAAChC,IAAD,EAAOiC,IAAP,EAAgB;AACxBzC,cAAQC,GAAR,CAAYO,IAAZ,EAAkBiC,IAAlB;AACD,KAtDW;AAuDZC,qBAAiB,yBAAClC,IAAD,EAAOiC,IAAP,EAAgB;AAC/BzC,cAAQC,GAAR,CAAY,iBAAZ,EAA+BO,IAA/B;AACD,KAzDW;AA0DZmC,2BAAuB,iCAAM;AAC3B3C,cAAQC,GAAR,CAAY,uBAAZ;AACD,KA5DW;AA6DZH,iBAAa;AACX8C,wBAAkB,gCAAQ;AACxB5C,gBAAQC,GAAR,CAAYwC,IAAZ;AACD;AAHU;AA7DD,GAAd;AAmED;;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 // url:\n // \"//links-comment.oss-cn-beijing.aliyuncs.com/comment/20190727/YQ-4VC1bL.jpeg\",\n // type: \"image/jpeg\",\n // uid: \"rc-upload-1564206005248-2\"\n // }\n ],\n value: \"\"\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 value={this.state.value}\n onChange={value => {\n this.setState({\n value\n });\n }}\n handleChangeFileList={fileList => {\n console.log(\"----\", 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: 58297,\n currentUser: {\n user_id: 58297\n },\n userAvaHoverData: {\n 71763: {\n nickname: \"aaa\",\n followers: 20,\n fans: 2,\n isFollowed: true\n },\n 71748: {\n nickname: \"L0\",\n followers: 10,\n fans: 11,\n isFollowed: false\n },\n 71299: {\n nickname: \"narro\",\n followers: 10,\n fans: 11,\n isFollowed: false\n }\n },\n showHoverCard: true,\n showEdit: true,\n userAvaClick: id => {\n console.log(\"userAvaClick\", id);\n },\n getUserInfo: id => {\n console.log(\"getinfo:\", id);\n },\n focus: id => {\n return new Promise(function(resolve, reject) {\n console.log(\"focus:\", id);\n resolve();\n });\n },\n unFocus: id => {\n return new Promise(function(resolve, reject) {\n console.log(\"unFocus:\", id);\n resolve();\n });\n },\n onCountChange: c => {\n console.log(c);\n },\n onDelete: (type, data) => {\n console.log(type, data);\n },\n onUpdateComment: (type, data) => {\n console.log(\"onUpdateComment\", type);\n },\n onBeforeUpdateComment: () => {\n console.log(\"onBeforeUpdateComment\");\n },\n editorProps: {\n onCommentSuccess: data => {\n console.log(data);\n }\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"]}