通用评论

index.js 23KB

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