1
|
-{"version":3,"sources":["../src/index.js"],"names":["Index","props","renderComment","config","id","Error","type","businessId","console","warn","API","userId","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;;;;;;;;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;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;AAhB4B,MAkB3BL,EAlB2B,GAuBzBD,MAvByB,CAkB3BC,EAlB2B;AAAA,qBAuBzBD,MAvByB,CAmB3BG,IAnB2B;AAAA,MAmB3BA,IAnB2B,gCAmBpB,CAnBoB;AAAA,2BAuBzBH,MAvByB,CAoB3BI,UApB2B;AAAA,MAoB3BA,UApB2B,sCAoBd,MApBc;AAAA,oBAuBzBJ,MAvByB,CAqB3BO,GArB2B;AAAA,MAqB3BA,GArB2B,+BAqBrB,oCArBqB;AAAA,MAsB3BC,MAtB2B,GAuBzBR,MAvByB,CAsB3BQ,MAtB2B;;;AAyB7BC,qBAASC,MAAT,CACE,8BAAC,KAAD,IAAO,MAAMP,IAAb,EAAmB,YAAYC,UAA/B,EAA2C,KAAKG,GAAhD,EAAqD,QAAQC,MAA7D,GADF,EAEEG,SAASC,cAAT,CAAwBX,EAAxB,CAFF;AAIA;AACD;;AAEDY,OAAOd,aAAP,GAAuBA,aAAvB;;AAEAA,cAAc;AACZE,MAAI,cADQ;AAEZE,QAAM,CAFM;AAGZC,cAAY;AAHA,CAAd;;AAMA;AACA;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\n// import 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 * - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\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.type) {\r\n throw new Error(\"type is required\");\r\n }\r\n if (!config.businessId) {\r\n // throw new Error(\"businessId is required\");\r\n console.warn(\"没有传入 businessId 参数,默认使用: test\");\r\n }\r\n if (!config.API) {\r\n // throw new Error(\"API is required\");\r\n console.warn(\r\n \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\r\n );\r\n }\r\n const {\r\n id,\r\n type = 1,\r\n businessId = \"test\",\r\n API = \"http://api.links123.net/comment/v1\",\r\n userId\r\n } = config;\r\n\r\n ReactDOM.render(\r\n <Index type={type} businessId={businessId} API={API} userId={userId} />,\r\n document.getElementById(id)\r\n );\r\n // registerServiceWorker();\r\n}\r\n\r\nwindow.renderComment = renderComment;\r\n\r\nrenderComment({\r\n id: \"root-comment\",\r\n type: 1,\r\n businessId: \"test\"\r\n});\r\n\r\n// renderComment({\r\n// id: \"root-comment\",\r\n// type: 1,\r\n// businessId: \"test\",\r\n// API: 'http://api.links123.net/comment/v1',\r\n// });\r\n"]}
|
|
|
|
|
1
|
+{"version":3,"sources":["../src/index.js"],"names":["Index","props","editorProps","renderComment","config","id","Error","type","businessId","console","warn","API","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,aAAQ,WAAW,CAAnB,EAAsB,eAAtB,IAAoCA,MAAMC,WAA1C;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;;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;;AAEAA,cAAc;AACZE,MAAI,cADQ;AAEZE,QAAM,CAFM;AAGZC,cAAY;AAHA,CAAd;;AAMA;AACA;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\n// import registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nconst Index = props => (\r\n <App showAlertComment showAlertReply showAlertFavor showError {...props}>\r\n <Editor maxUpload={9} autoFocus {...props.editorProps} />\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 * - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\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.type) {\r\n throw new Error(\"type is required\");\r\n }\r\n if (!config.businessId) {\r\n // throw new Error(\"businessId is required\");\r\n config.businessId = \"test\";\r\n console.warn(\"没有传入 businessId 参数,默认使用: test\");\r\n }\r\n if (!config.API) {\r\n // throw new Error(\"API is required\");\r\n config.API = \"http://api.links123.net/comment/v1\";\r\n console.warn(\r\n \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\r\n );\r\n }\r\n\r\n ReactDOM.render(<Index {...config} />, document.getElementById(config.id));\r\n // registerServiceWorker();\r\n}\r\n\r\nwindow.renderComment = renderComment;\r\n\r\nrenderComment({\r\n id: \"root-comment\",\r\n type: 1,\r\n businessId: \"test\"\r\n});\r\n\r\n// renderComment({\r\n// id: \"root-comment\",\r\n// type: 1,\r\n// businessId: \"test\",\r\n// API: 'http://api.links123.net/comment/v1',\r\n// });\r\n"]}
|