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\";\r\nimport ReactDOM from \"react-dom\";\r\nimport App, { Editor } from \"./App\";\r\nimport registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nconst Index = props => (\r\n <App showAlertComment showAlertReply showAlertFavor showError {...props}>\r\n <Editor maxUpload={9} autoFocus />\r\n </App>\r\n);\r\n\r\n/**\r\n * 渲染评论组件\r\n * @param {object} config 编辑器配置\r\n * - {string} id 渲染评论的DOM的 ID\r\n * - {number} type 评论的 type\r\n * - {string} businessId 评论的 businessId\r\n */\r\nfunction renderComment(config) {\r\n if (!config.id) {\r\n throw new Error(\"id is required\");\r\n }\r\n if (!config.id) {\r\n throw new Error(\"type is required\");\r\n }\r\n if (!config.id) {\r\n throw new Error(\"businessId is required\");\r\n }\r\n const { id, type = 1, businessId = \"test\" } = config;\r\n\r\n ReactDOM.render(\r\n <Index type={type} businessId={businessId} />,\r\n document.getElementById(id)\r\n );\r\n // registerServiceWorker();\r\n}\r\n\r\nwindow.renderComment = renderComment;\r\n\r\n// renderComment({\r\n// id: \"root-comment\",\r\n// type: 1,\r\n// businessId: \"test\"\r\n// });\r\n"]}
|