通用评论

index.js 23KB

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