通用评论

index.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _button = require("antd/es/button");
  6. var _button2 = _interopRequireDefault(_button);
  7. var _popover = require("antd/es/popover");
  8. var _popover2 = _interopRequireDefault(_popover);
  9. var _icon = require("antd/es/icon");
  10. var _icon2 = _interopRequireDefault(_icon);
  11. var _message2 = require("antd/es/message");
  12. var _message3 = _interopRequireDefault(_message2);
  13. var _input = require("antd/es/input");
  14. var _input2 = _interopRequireDefault(_input);
  15. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  16. require("antd/es/button/style");
  17. require("antd/es/popover/style");
  18. require("antd/es/icon/style");
  19. require("antd/es/message/style");
  20. require("antd/es/input/style");
  21. var _dayjs = require("dayjs");
  22. var _dayjs2 = _interopRequireDefault(_dayjs);
  23. var _shortid = require("shortid");
  24. var _shortid2 = _interopRequireDefault(_shortid);
  25. var _propTypes = require("prop-types");
  26. var _propTypes2 = _interopRequireDefault(_propTypes);
  27. var _classnames = require("classnames");
  28. var _classnames2 = _interopRequireDefault(_classnames);
  29. var _react = require("react");
  30. var _react2 = _interopRequireDefault(_react);
  31. var _reactIntlUniversal = require("react-intl-universal");
  32. var _reactIntlUniversal2 = _interopRequireDefault(_reactIntlUniversal);
  33. var _Emoji = require("./Emoji");
  34. var _Emoji2 = _interopRequireDefault(_Emoji);
  35. var _Upload = require("./Upload");
  36. var _Upload2 = _interopRequireDefault(_Upload);
  37. var _Comment = require("../../Comment");
  38. var _Comment2 = _interopRequireDefault(_Comment);
  39. var _utils = require("./../../utils");
  40. var _constant = require("../../constant");
  41. var _helper = require("../../helper");
  42. require("./index.css");
  43. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  44. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  45. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  46. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  47. var TextArea = _input2.default.TextArea;
  48. var client = function client(oss) {
  49. return new window.OSS.Wrapper({
  50. accessKeyId: oss.access_key_id,
  51. accessKeySecret: oss.access_key_secret,
  52. stsToken: oss.security_token,
  53. endpoint: _constant.OSS_ENDPOINT, //常量,你可以自己定义
  54. bucket: _constant.OSS_BUCKET
  55. });
  56. };
  57. var uploadPath = function uploadPath(path, file) {
  58. return path + "/" + (0, _dayjs2.default)().format("YYYYMMDD") + "/" + _shortid2.default.generate() + "." + file.type.split("/")[1];
  59. };
  60. var UploadToOss = function UploadToOss(oss, path, file) {
  61. var url = uploadPath(path, file);
  62. return new Promise(function (resolve, reject) {
  63. client(oss).multipartUpload(url, file).then(function (data) {
  64. resolve(data);
  65. }).catch(function (error) {
  66. reject(error);
  67. });
  68. });
  69. };
  70. var Editor = function (_React$Component) {
  71. _inherits(Editor, _React$Component);
  72. function Editor(props) {
  73. _classCallCheck(this, Editor);
  74. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  75. _this.state = {
  76. showUpload: false,
  77. value: props.value || "", // 编辑器里面的值
  78. fileList: props.fileList || [], // 图片列表
  79. fileMap: {}, // 已经上传的图片路径和 uid 的映射 { uid: path }
  80. uploadVisible: false // 上传图片弹窗是否可视
  81. };
  82. _this.handleChange = _this.handleChange.bind(_this);
  83. _this.handleClickEmoji = _this.handleClickEmoji.bind(_this);
  84. _this.handleChangeFileList = _this.handleChangeFileList.bind(_this);
  85. _this.handleShowUpload = _this.handleShowUpload.bind(_this);
  86. _this.handleUpload = _this.handleUpload.bind(_this);
  87. _this.handleSubmit = _this.handleSubmit.bind(_this);
  88. _this.handlePaste = _this.handlePaste.bind(_this);
  89. _this.resetState = _this.resetState.bind(_this);
  90. _this.handleEmojiScroll = _this.handleEmojiScroll.bind(_this);
  91. _this.handlePressEnter = _this.handlePressEnter.bind(_this);
  92. _this.invokeFileListChange = _this.invokeFileListChange.bind(_this);
  93. return _this;
  94. }
  95. _createClass(Editor, [{
  96. key: "componentDidMount",
  97. value: function componentDidMount() {
  98. var _props = this.props,
  99. app = _props.app,
  100. onRef = _props.onRef,
  101. uploadDefaultShow = _props.uploadDefaultShow;
  102. if (app.currentUser && (app.currentUser.user_id > 0 || app.currentUser.id > 0)) {
  103. app.sOssSts();
  104. }
  105. if ((0, _helper.isFunction)(onRef)) {
  106. onRef(this);
  107. }
  108. if (uploadDefaultShow) {
  109. var uploadFileList = this.props.fileList || this.state.fileList;
  110. if (uploadFileList.length > 0) {
  111. this.setState({
  112. uploadVisible: true
  113. });
  114. }
  115. }
  116. }
  117. }, {
  118. key: "handleEmojiScroll",
  119. value: function handleEmojiScroll(e) {
  120. if (!this.emoji) {
  121. return;
  122. }
  123. e.preventDefault();
  124. if (e.deltaY > 0) {
  125. this.emoji.next();
  126. } else if (e.deltaY < 0) {
  127. this.emoji.prev();
  128. }
  129. }
  130. /**
  131. * 编辑器的值改变事件
  132. * 将最新的值存储到 state 中
  133. * @param {string} value 输入的值
  134. */
  135. }, {
  136. key: "handleChange",
  137. value: function handleChange(value) {
  138. this.setState({ value: value });
  139. if (this.props.onChange) {
  140. this.props.onChange(value);
  141. }
  142. }
  143. /**
  144. * 点击 emoji 的事件
  145. * 点击后,需要将改 emoji 插入到编辑器中
  146. * 插入的值为 [emoji chinese name]
  147. * 参数 emoji 即为 emoji chinese name
  148. * @param {string}} emoji emoji 的中文,如 微笑
  149. */
  150. }, {
  151. key: "handleClickEmoji",
  152. value: function handleClickEmoji(emoji) {
  153. var value = this.props.value || this.state.value;
  154. value += "[" + emoji + "]";
  155. this.handleChange(value);
  156. }
  157. /**
  158. * 监听文件列表改变事件
  159. * @param {Array} fileList 文件列表
  160. */
  161. }, {
  162. key: "handleChangeFileList",
  163. value: function handleChangeFileList(fileList) {
  164. var list = fileList;
  165. if (fileList.length > this.props.maxUpload) {
  166. list = fileList.slice(0, this.props.maxUpload);
  167. }
  168. this.invokeFileListChange(list);
  169. }
  170. /**
  171. * 控制上传 Popover 的显示和隐藏
  172. * @param {boolean} showUpload 是否显示上传的 Popover
  173. */
  174. }, {
  175. key: "handleShowUpload",
  176. value: function handleShowUpload(showUpload) {
  177. if (typeof showUpload === "boolean") {
  178. this.setState({ showUpload: showUpload });
  179. } else {
  180. this.setState({ showUpload: !this.state.showUpload });
  181. }
  182. }
  183. /**
  184. * 上传文件
  185. * @param {object} param 文件对象
  186. */
  187. }, {
  188. key: "handleUpload",
  189. value: function handleUpload(_ref) {
  190. var uid = _ref.uid,
  191. path = _ref.path;
  192. var fileMap = this.state.fileMap;
  193. var fileList = this.state.fileList;
  194. fileMap[uid] = path;
  195. fileList = fileList.map(function (item) {
  196. if (item.uid === uid) {
  197. item.thumbUrl = _constant.OSS_LINK + path;
  198. }
  199. return item;
  200. });
  201. this.setState({ fileMap: fileMap });
  202. this.invokeFileListChange(fileList);
  203. }
  204. /**
  205. * **统一处理fileList的修改**
  206. * 1. upload
  207. * 2. paste
  208. * PS: 移动端需要做额外操作
  209. * -- evo 20200223
  210. */
  211. }, {
  212. key: "invokeFileListChange",
  213. value: function invokeFileListChange(fileList) {
  214. var _props2 = this.props,
  215. limitOne = _props2.limitOne,
  216. handleChangeFileList = _props2.handleChangeFileList;
  217. handleChangeFileList(fileList);
  218. this.setState({ fileList: fileList });
  219. if (limitOne && _utils.isMobile) {
  220. var file = fileList[0];
  221. if (file && file.status === "done" && !file.thumbUrl.includes("data:image")) {
  222. this.setState({ uploadVisible: false });
  223. }
  224. }
  225. }
  226. /**
  227. * 粘贴回调
  228. */
  229. }, {
  230. key: "handlePaste",
  231. value: function handlePaste(e) {
  232. var _this2 = this;
  233. if (this.state.fileList.length >= this.props.maxUpload) {
  234. return;
  235. }
  236. var items = e.clipboardData && e.clipboardData.items;
  237. var file = null;
  238. if (items && items.length) {
  239. for (var i = 0; i < items.length; i++) {
  240. if (items[i].type.indexOf("image") !== -1) {
  241. file = items[i].getAsFile();
  242. break;
  243. }
  244. }
  245. if (file === null) return;
  246. }
  247. this.setState({
  248. uploadVisible: true
  249. });
  250. var reader = new FileReader();
  251. reader.readAsDataURL(file);
  252. reader.onloadend = function () {
  253. // DRIVER_LICENSE_PATH oss 的存储路径位置
  254. UploadToOss(_this2.props.app.oss, _constant.DRIVER_LICENSE_PATH, file).then(function (data) {
  255. var fileList = _this2.state.fileList.concat({
  256. url: _constant.OSS_LINK + data.name,
  257. thumbUrl: _constant.OSS_LINK + data.name,
  258. type: file.type,
  259. uid: new Date().valueOf()
  260. });
  261. _this2.invokeFileListChange(fileList);
  262. }).catch(function (e) {
  263. var msg = e.message || _constant.ERROR_DEFAULT;
  264. if (_this2.props.showError) {
  265. _message3.default.error(msg);
  266. }
  267. if (_this2.props.onError) {
  268. _this2.props.onError(msg, { response: e.response });
  269. }
  270. });
  271. };
  272. }
  273. /**
  274. * 提交编辑器内容
  275. * 提交功能,交给父组件来实现
  276. * 需要父组件传入 onSubmit
  277. */
  278. }, {
  279. key: "handleSubmit",
  280. value: function handleSubmit() {
  281. var _this3 = this;
  282. var maxLength = this.props.maxLength;
  283. var _state = this.state,
  284. value = _state.value,
  285. fileMap = _state.fileMap,
  286. fileList = _state.fileList;
  287. if (value.length > maxLength) {
  288. // message.error(`字数不得超过${maxLength}字`);
  289. _message3.default.error(_reactIntlUniversal2.default.get("editor.maxLength", { maxLength: maxLength }));
  290. return;
  291. }
  292. var files = [];
  293. if (fileList.length) {
  294. fileList.forEach(function (item) {
  295. if (item.url) {
  296. files.push(item.url);
  297. return;
  298. }
  299. if (!fileMap[item.uid]) {
  300. return;
  301. }
  302. files.push("" + _constant.OSS_LINK + fileMap[item.uid]);
  303. });
  304. }
  305. if (this.props.beforeSubmit) {
  306. Promise.resolve(this.props.beforeSubmit({ text: value, files: files })).then(function (res) {
  307. if (!(res === false)) {
  308. _this3.props.onSubmit({ text: value, files: files }, function (res, action) {
  309. _this3.resetState();
  310. if (action === "comment" && _this3.props.onCommentSuccess) {
  311. _this3.props.onCommentSuccess(res);
  312. }
  313. });
  314. }
  315. });
  316. } else {
  317. this.props.onSubmit({ text: value, files: files }, function (res, action) {
  318. _this3.resetState();
  319. if (action === "comment" && _this3.props.onCommentSuccess) {
  320. _this3.props.onCommentSuccess(res);
  321. }
  322. });
  323. }
  324. }
  325. }, {
  326. key: "resetState",
  327. value: function resetState() {
  328. this.handleChange("");
  329. this.handleChangeFileList([]);
  330. this.setState({
  331. showUpload: false,
  332. value: "",
  333. fileList: [],
  334. fileMap: {}
  335. });
  336. }
  337. }, {
  338. key: "checkDisabledSubmit",
  339. value: function checkDisabledSubmit() {
  340. var _props3 = this.props,
  341. btnDisabled = _props3.btnDisabled,
  342. value = _props3.value,
  343. fileList = _props3.fileList;
  344. if (btnDisabled) {
  345. return true;
  346. }
  347. if (value && value !== "") {
  348. return false;
  349. }
  350. if (this.state.value && this.state.value !== "") {
  351. return false;
  352. }
  353. if (fileList && fileList.length > 0) {
  354. return false;
  355. }
  356. if (this.state.fileList.length > 0) {
  357. return false;
  358. }
  359. return true;
  360. }
  361. /**
  362. * **处理Enter事件**
  363. * 1. `allowEnterSubmit`为true时enter触发submit事件
  364. * 2. `e.preventDefault`为了防止enter事件后仍触发换行
  365. * 3. enter事件开启后,仍可以用`shift + enter`触发换行
  366. * -- evo 20200222
  367. */
  368. }, {
  369. key: "handlePressEnter",
  370. value: function handlePressEnter(e) {
  371. if (this.props.allowEnterSubmit) {
  372. if (!e.shiftKey) {
  373. e.preventDefault();
  374. this.handleSubmit();
  375. }
  376. }
  377. }
  378. }, {
  379. key: "render",
  380. value: function render() {
  381. var _this4 = this;
  382. var _props4 = this.props,
  383. value = _props4.value,
  384. rows = _props4.rows,
  385. showEmoji = _props4.showEmoji,
  386. showUpload = _props4.showUpload,
  387. multiple = _props4.multiple,
  388. emojiPopoverPlacement = _props4.emojiPopoverPlacement,
  389. uploadPopoverPlacement = _props4.uploadPopoverPlacement,
  390. uploadOverlayClassName = _props4.uploadOverlayClassName,
  391. fileList = _props4.fileList,
  392. maxUpload = _props4.maxUpload,
  393. btnLoading = _props4.btnLoading,
  394. button = _props4.button,
  395. emojiToolIcon = _props4.emojiToolIcon,
  396. imageToolIcon = _props4.imageToolIcon,
  397. maxLength = _props4.maxLength,
  398. autoFocus = _props4.autoFocus,
  399. app = _props4.app;
  400. var placeholder = this.props.placeholder || _reactIntlUniversal2.default.get("editor.placeholder");
  401. var btnSubmitText = this.props.btnSubmitText || _reactIntlUniversal2.default.get("editor.SubmitBtn");
  402. var handleSubmit = this.handleSubmit;
  403. var disabledSubmit = this.checkDisabledSubmit();
  404. var inputValue = value || this.state.value;
  405. var uploadFileList = fileList || this.state.fileList;
  406. var isLogin = app.currentUser && (app.currentUser.user_id > 0 || app.currentUser.id > 0);
  407. return _react2.default.createElement(
  408. "div",
  409. { className: "comment-editor-container", onPaste: this.handlePaste },
  410. isLogin ? _react2.default.createElement(
  411. _react.Fragment,
  412. null,
  413. _react2.default.createElement("div", {
  414. className: (0, _classnames2.default)({
  415. "comment-editor-toolbar": true,
  416. "comment-editor-toolbar-error": inputValue.length > maxLength
  417. })
  418. }),
  419. _react2.default.createElement(
  420. "div",
  421. { className: "comment-editor" },
  422. _react2.default.createElement(TextArea, {
  423. value: inputValue,
  424. onChange: function onChange(e) {
  425. _this4.handleChange(e.target.value);
  426. },
  427. rows: rows,
  428. placeholder: placeholder,
  429. autoFocus: autoFocus,
  430. onPressEnter: this.handlePressEnter
  431. }),
  432. _react2.default.createElement(
  433. "div",
  434. { className: "comment-toolbar" },
  435. _react2.default.createElement(
  436. "div",
  437. { className: "comment-toolbar-left" },
  438. showEmoji && _react2.default.createElement(
  439. _popover2.default,
  440. {
  441. trigger: "click",
  442. placement: emojiPopoverPlacement,
  443. autoAdjustOverflow: false,
  444. overlayStyle: { zIndex: 9999 },
  445. content: _react2.default.createElement(
  446. "div",
  447. {
  448. style: { width: 240, height: 205 },
  449. onWheel: this.handleEmojiScroll
  450. },
  451. _react2.default.createElement(_Emoji2.default, {
  452. onClick: this.handleClickEmoji,
  453. ref: function ref(node) {
  454. _this4.emoji = node;
  455. },
  456. emojiList: this.props.app.emojiList
  457. })
  458. ),
  459. overlayClassName: "comment-emoji-popover"
  460. },
  461. emojiToolIcon || _react2.default.createElement(_icon2.default, { type: "smile-o", className: "comment-toolbar-icon" })
  462. ),
  463. showUpload ? _react2.default.createElement(
  464. _popover2.default,
  465. {
  466. trigger: "click"
  467. // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
  468. , visible: this.state.uploadVisible,
  469. placement: uploadPopoverPlacement,
  470. overlayClassName: uploadOverlayClassName,
  471. autoAdjustOverflow: false,
  472. overlayStyle: { zIndex: 9999 },
  473. onVisibleChange: function onVisibleChange(visible) {
  474. _this4.setState({
  475. uploadVisible: visible
  476. });
  477. },
  478. content: _react2.default.createElement(
  479. "div",
  480. { className: "comment-img-popover" },
  481. _react2.default.createElement(_Upload2.default, {
  482. onRef: function onRef(node) {
  483. return _this4.uploadRef = node;
  484. },
  485. multiple: multiple,
  486. onChangeFileList: this.handleChangeFileList,
  487. onUpload: this.handleUpload,
  488. maxUpload: maxUpload,
  489. fileList: uploadFileList,
  490. showError: this.props.showError,
  491. onError: this.props.onError
  492. }),
  493. _react2.default.createElement("div", { className: "clearfix" })
  494. ),
  495. title: _react2.default.createElement(
  496. "div",
  497. { className: "comment-img-title" },
  498. _react2.default.createElement(
  499. "span",
  500. null,
  501. _reactIntlUniversal2.default.get("editor.uploadTip"),
  502. maxUpload >= 2 ? _react2.default.createElement(
  503. "span",
  504. { className: "comment-img-title-counter" },
  505. _reactIntlUniversal2.default.get("editor.uploadCount", {
  506. count: maxUpload - uploadFileList.length
  507. })
  508. ) : null
  509. )
  510. )
  511. },
  512. imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
  513. onClick: function onClick() {
  514. return _this4.handleShowUpload(true);
  515. }
  516. }) : _react2.default.createElement(_icon2.default, {
  517. type: "picture",
  518. className: "comment-toolbar-icon",
  519. style: { marginLeft: 20 },
  520. onClick: function onClick() {
  521. return _this4.handleShowUpload(true);
  522. }
  523. })
  524. ) : null
  525. ),
  526. _react2.default.createElement(
  527. "div",
  528. { className: "comment-toolbar-right" },
  529. button ? _react2.default.cloneElement(button, {
  530. onClick: button.props.onClick || handleSubmit
  531. }) : _react2.default.createElement(
  532. _button2.default,
  533. {
  534. onClick: function onClick() {
  535. return _this4.handleSubmit();
  536. },
  537. type: "primary",
  538. loading: btnLoading,
  539. disabled: disabledSubmit
  540. },
  541. btnSubmitText
  542. )
  543. )
  544. )
  545. )
  546. ) : _react2.default.createElement(
  547. _react.Fragment,
  548. null,
  549. _react2.default.createElement(
  550. "div",
  551. { className: "comment-unlogin-tip" },
  552. _reactIntlUniversal2.default.get("comment.unlogin")
  553. ),
  554. _react2.default.createElement(
  555. "div",
  556. { className: "comment-unlogin-button" },
  557. _react2.default.createElement(
  558. _button2.default,
  559. {
  560. type: "primary",
  561. onClick: function onClick() {
  562. window.location.href = app.LOGINLINK + "?f=" + window.location.href;
  563. }
  564. },
  565. _reactIntlUniversal2.default.get("account.login")
  566. )
  567. )
  568. )
  569. );
  570. }
  571. }]);
  572. return Editor;
  573. }(_react2.default.Component);
  574. Editor.propTypes = {
  575. rows: _propTypes2.default.number,
  576. placeholder: _propTypes2.default.string,
  577. showEmoji: _propTypes2.default.bool,
  578. emojiPopoverPlacement: _propTypes2.default.string,
  579. showUpload: _propTypes2.default.bool,
  580. uploadPopoverPlacement: _propTypes2.default.string,
  581. uploadOverlayClassName: _propTypes2.default.string,
  582. multiple: _propTypes2.default.bool,
  583. closeUploadWhenBlur: _propTypes2.default.bool,
  584. maxUpload: _propTypes2.default.number,
  585. value: _propTypes2.default.string,
  586. onChange: _propTypes2.default.func,
  587. onSubmit: _propTypes2.default.func,
  588. beforeSubmit: _propTypes2.default.func,
  589. btnSubmitText: _propTypes2.default.string,
  590. btnLoading: _propTypes2.default.bool,
  591. btnDisabled: _propTypes2.default.bool,
  592. button: _propTypes2.default.node,
  593. emojiToolIcon: _propTypes2.default.node,
  594. imageToolIcon: _propTypes2.default.node,
  595. uploadDefaultShow: _propTypes2.default.bool,
  596. showError: _propTypes2.default.bool,
  597. onError: _propTypes2.default.func,
  598. maxLength: _propTypes2.default.number,
  599. // Enter事件相关
  600. allowEnterSubmit: _propTypes2.default.bool,
  601. // 私信仅允许选中一个,此处可以优化为通用的limit
  602. limitOne: _propTypes2.default.bool
  603. };
  604. Editor.defaultProps = {
  605. rows: 5,
  606. // placeholder: "说点什么吧",
  607. showEmoji: true,
  608. showUpload: true,
  609. uploadDefaultShow: true,
  610. multiple: true,
  611. emojiPopoverPlacement: "bottomLeft",
  612. closeUploadWhenBlur: false,
  613. uploadPopoverPlacement: "bottomLeft",
  614. uploadOverlayClassName: "",
  615. maxUpload: 1,
  616. // btnSubmitText: "发表",
  617. btnLoading: false,
  618. btnDisabled: false,
  619. showError: true,
  620. maxLength: 5000,
  621. app: {},
  622. handleChangeFileList: function handleChangeFileList() {},
  623. // Enter事件相关
  624. allowEnterSubmit: false,
  625. limitOne: false
  626. };
  627. exports.default = (0, _Comment2.default)(Editor);
  628. //# sourceMappingURL=index.js.map