通用评论

1
  1. {"version":3,"sources":["../src/index.js"],"names":["Index","props","renderComment","config","id","Error","type","businessId","ReactDOM","render","document","getElementById","window"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,IAAQ,WAAW,CAAnB,EAAsB,eAAtB;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;AAOA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,wBAAV,CAAN;AACD;AAT4B,MAUrBD,EAVqB,GAUiBD,MAVjB,CAUrBC,EAVqB;AAAA,qBAUiBD,MAVjB,CAUjBG,IAViB;AAAA,MAUjBA,IAViB,gCAUV,CAVU;AAAA,2BAUiBH,MAVjB,CAUPI,UAVO;AAAA,MAUPA,UAVO,sCAUM,MAVN;;;AAY7BC,qBAASC,MAAT,CACE,8BAAC,KAAD,IAAO,MAAMH,IAAb,EAAmB,YAAYC,UAA/B,GADF,EAEEG,SAASC,cAAT,CAAwBP,EAAxB,CAFF;AAIA;AACD;;AAEDQ,OAAOV,aAAP,GAAuBA,aAAvB;;AAEA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App, { Editor } from \"./App\";\nimport registerServiceWorker from \"./registerServiceWorker\";\n\nconst Index = props => (\n <App showAlertComment showAlertReply showAlertFavor showError {...props}>\n <Editor maxUpload={9} autoFocus />\n </App>\n);\n\n/**\n * 渲染评论组件\n * @param {object} config 编辑器配置\n * - {string} id 渲染评论的DOM的 ID\n * - {number} type 评论的 type\n * - {string} businessId 评论的 businessId\n */\nfunction renderComment(config) {\n if (!config.id) {\n throw new Error(\"id is required\");\n }\n if (!config.id) {\n throw new Error(\"type is required\");\n }\n if (!config.id) {\n throw new Error(\"businessId is required\");\n }\n const { id, type = 1, businessId = \"test\" } = config;\n\n ReactDOM.render(\n <Index type={type} businessId={businessId} />,\n document.getElementById(id)\n );\n // registerServiceWorker();\n}\n\nwindow.renderComment = renderComment;\n\n// renderComment({\n// id: \"root-comment\",\n// type: 1,\n// businessId: \"test\"\n// });\n"]}