通用评论

1
  1. {"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","carousel","next","prev","onClick","props","content","curPage","i","length","push","emoji","node","map","page","index","item","value","prefixUrl","ext","title","display","React","Component"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;;;;;;;AACA;AACA;;AAEA;;IAEMA,K;;;;;;;;;;;2BAEG;AACL,UAAI,KAAKC,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcC,IAAd;AACD;AACF;;;2BAEM;AACL,UAAI,KAAKD,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcE,IAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,UACCC,QADD,GACa,KAAKC,KADlB,CACCD,OADD;;AAEP,UAAME,UAAU,EAAhB;AACA,UAAIC,UAAU,EAAd;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAI,GAApB,EAAyBA,GAAzB,EAA8B;AAC5B,YAAID,QAAQE,MAAR,GAAiB,EAArB,EAAyB;AACvBF,kBAAQG,IAAR,CAAaC,gBAAMH,CAAN,CAAb;AACD,SAFD,MAEO;AACLF,kBAAQI,IAAR,CAAaH,OAAb;AACAA,oBAAU,EAAV;AACD;AACF;AACD,UAAIA,QAAQE,MAAR,GAAiB,CAArB,EAAwB;AACtBH,gBAAQI,IAAR,CAAaH,OAAb;AACD;AACD,aACE;AAAA;AAAA,UAAU,KAAK,aAACK,IAAD,EAAU;AAAE,mBAAKX,QAAL,GAAgBW,IAAhB;AAAuB,WAAlD;AACGN,gBAAQO,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,iBACX;AAAA;AAAA,cAAK,KAAKA,KAAV,EAAiB,WAAU,OAA3B;AACGD,iBAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,qBACR;AAAA;AAAA,kBAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,KAAhC;AACE,wDAAM,WAAU,QAAhB,GADF;AAEE;AACE,4BAAQC,gBAAR,GAAoBF,KAAKC,KAAzB,SAAkCD,KAAKG,GADzC;AAEE,uBAAKH,KAAKI,KAFZ;AAGE,yBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,2BAAS;AAAA,2BAAMjB,SAAQY,KAAKI,KAAb,CAAN;AAAA;AAJX;AAFF,eADQ;AAAA,aAAT;AADH,WADW;AAAA,SAAZ;AADH,OADF;AAmBD;;;;EAhDiBE,gBAAMC,S;;kBAmDXvB,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\r\nimport { Carousel } from \"antd\";\r\nimport emoji, { prefixUrl } from \"../../emoji\";\r\nimport \"./Emoji.css\";\r\n// 每页 20 5*4\r\n// 共 20 * 3 = 60 (实际是 54)\r\n\r\n// class Emoji\r\n\r\nclass Emoji extends React.Component {\r\n\r\n next() {\r\n if (this.carousel) {\r\n this.carousel.next();\r\n }\r\n }\r\n\r\n prev() {\r\n if (this.carousel) {\r\n this.carousel.prev();\r\n }\r\n }\r\n\r\n render() {\r\n const { onClick } = this.props;\r\n const content = [];\r\n let curPage = [];\r\n for (let i = 0; i < 115; i++) {\r\n if (curPage.length < 30) {\r\n curPage.push(emoji[i]);\r\n } else {\r\n content.push(curPage);\r\n curPage = [];\r\n }\r\n }\r\n if (curPage.length > 0) {\r\n content.push(curPage);\r\n }\r\n return (\r\n <Carousel ref={(node) => { this.carousel = node; }}>\r\n {content.map((page, index) => (\r\n <div key={index} className=\"emoji\">\r\n {page.map((item, index) => (\r\n <div className=\"item\" key={item.value}>\r\n <span className=\"helper\" />\r\n <img\r\n src={`${prefixUrl}${item.value}.${item.ext}`}\r\n alt={item.title}\r\n style={{ display: \"inline-block\" }}\r\n onClick={() => onClick(item.title)}\r\n />\r\n </div>\r\n ))}\r\n </div>\r\n ))}\r\n </Carousel>\r\n );\r\n };\r\n}\r\n\r\nexport default Emoji;\r\n"]}