通用评论

index.js 24KB

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