通用评论

index.js.map 7.7KB

1
  1. {"version":3,"sources":["../src/index.js"],"names":["Index","props","state","fileList","value","editorProps","setState","React","Component","renderComment","config","id","Error","type","businessId","console","warn","API","ReactDOM","render","document","getElementById","window","process","env","NODE_ENV","businessUserId","userId","currentUser","user_id","userAvaHoverData","nickname","followers","fans","isFollowed","showHoverCard","showEdit","userAvaClick","log","getUserInfo","focus","Promise","resolve","reject","unFocus","onCountChange","onDelete","data","onCommentFail","onUpdateComment","onBeforeUpdateComment","sendMessage","preRenderValue","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,EAAEF,YAAF,EAAd;AACD,WARH;AASE,gCAAsB,wCAAY;AAChC,mBAAKE,QAAL,CAAc;AACZH;AADY,aAAd;AAGD,WAbH;AAcE,gCAdF;AAeE;AAfF;AAPF,OADF;AA2BD;;;;EA5CiBI,gBAAMC,S;;AA+C1B;;;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,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M;AACjBxB,cAAQuB,GAAR,CAAY,UAAZ,EAAwB3B,EAAxB;AACD,KA1CW;AA2CZ6B,WAAO,mBAAM;AACX,aAAO,IAAIC,OAAJ,CAAY,UAASC,OAAT,EAAkBC,MAAlB,EAA0B;AAC3C5B,gBAAQuB,GAAR,CAAY,QAAZ,EAAsB3B,EAAtB;AACA+B;AACD,OAHM,CAAP;AAID,KAhDW;AAiDZE,aAAS,qBAAM;AACb,aAAO,IAAIH,OAAJ,CAAY,UAASC,OAAT,EAAkBC,MAAlB,EAA0B;AAC3C5B,gBAAQuB,GAAR,CAAY,UAAZ,EAAwB3B,EAAxB;AACA+B;AACD,OAHM,CAAP;AAID,KAtDW;AAuDZG,mBAAe,0BAAK;AAClB;AACD,KAzDW;AA0DZC,cAAU,kBAACjC,IAAD,EAAOkC,IAAP,EAAgB;AACxBhC,cAAQuB,GAAR,CAAYzB,IAAZ,EAAkBkC,IAAlB;AACD,KA5DW;AA6DZC,mBAAe,6BAAQ;AACrBjC,cAAQuB,GAAR,CAAY,eAAZ,EAA6BS,IAA7B;AACD,KA/DW;AAgEZE,qBAAiB,yBAACpC,IAAD,EAAOkC,IAAP,EAAgB;AAC/BhC,cAAQuB,GAAR,CAAY,iBAAZ,EAA+BzB,IAA/B;AACD,KAlEW;AAmEZqC,2BAAuB,iCAAM;AAC3BnC,cAAQuB,GAAR,CAAY,uBAAZ;AACD,KArEW;AAsEZa,iBAAa,yBAAM;AACjBpC,cAAQuB,GAAR,CAAY,aAAZ,EAA2B3B,EAA3B;AACD,KAxEW;AAyEZyC,oBAAgB,+BAAS;AACvB,kBAAUhD,KAAV;AACD,KA3EW;AA4EZC,iBAAa;AACXgD,wBAAkB,gCAAQ;AACxBtC,gBAAQuB,GAAR,CAAYS,IAAZ;AACD;AAHU;AA5ED,GAAd;AAkFD;;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({ value });\n }}\n handleChangeFileList={fileList => {\n this.setState({\n fileList\n });\n }}\n allowEnterSubmit\n limitOne\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: 3,\n businessId: \"5ea8320dedd68200018e733d\",\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 58297: {\n nickname: \"aaaaa\",\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 onCommentFail: data => {\n console.log(\"onCommentFail\", data);\n },\n onUpdateComment: (type, data) => {\n console.log(\"onUpdateComment\", type);\n },\n onBeforeUpdateComment: () => {\n console.log(\"onBeforeUpdateComment\");\n },\n sendMessage: id => {\n console.log(\"sendMessage\", id);\n },\n preRenderValue: value => {\n return `${value}`;\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"]}