|  | @@ -138,6 +138,7 @@ var Editor = function (_React$Component) {
 | 
	
		
			
			| 138 | 138 |      _this.handlePaste = _this.handlePaste.bind(_this);
 | 
	
		
			
			| 139 | 139 |      _this.resetState = _this.resetState.bind(_this);
 | 
	
		
			
			| 140 | 140 |      _this.handleEmojiScroll = _this.handleEmojiScroll.bind(_this);
 | 
	
		
			
			|  | 141 | +    _this.handlePressEnter = _this.handlePressEnter.bind(_this);
 | 
	
		
			
			| 141 | 142 |      return _this;
 | 
	
		
			
			| 142 | 143 |    }
 | 
	
		
			
			| 143 | 144 |  
 | 
	
	
		
			
			|  | @@ -400,6 +401,25 @@ var Editor = function (_React$Component) {
 | 
	
		
			
			| 400 | 401 |        }
 | 
	
		
			
			| 401 | 402 |        return true;
 | 
	
		
			
			| 402 | 403 |      }
 | 
	
		
			
			|  | 404 | +
 | 
	
		
			
			|  | 405 | +    /**
 | 
	
		
			
			|  | 406 | +     *  **处理Enter事件**
 | 
	
		
			
			|  | 407 | +     *  1. `allowEnterSubmit`为true时enter触发submit事件
 | 
	
		
			
			|  | 408 | +     *  2. `e.preventDefault`为了防止enter事件后仍触发换行
 | 
	
		
			
			|  | 409 | +     *  3. enter事件开启后,仍可以用`shift + enter`触发换行
 | 
	
		
			
			|  | 410 | +     *  -- evo 20200222
 | 
	
		
			
			|  | 411 | +     */
 | 
	
		
			
			|  | 412 | +
 | 
	
		
			
			|  | 413 | +  }, {
 | 
	
		
			
			|  | 414 | +    key: "handlePressEnter",
 | 
	
		
			
			|  | 415 | +    value: function handlePressEnter(e) {
 | 
	
		
			
			|  | 416 | +      if (this.props.allowEnterSubmit) {
 | 
	
		
			
			|  | 417 | +        if (!e.shiftKey) {
 | 
	
		
			
			|  | 418 | +          e.preventDefault();
 | 
	
		
			
			|  | 419 | +          this.handleSubmit();
 | 
	
		
			
			|  | 420 | +        }
 | 
	
		
			
			|  | 421 | +      }
 | 
	
		
			
			|  | 422 | +    }
 | 
	
		
			
			| 403 | 423 |    }, {
 | 
	
		
			
			| 404 | 424 |      key: "render",
 | 
	
		
			
			| 405 | 425 |      value: function render() {
 | 
	
	
		
			
			|  | @@ -431,6 +451,7 @@ var Editor = function (_React$Component) {
 | 
	
		
			
			| 431 | 451 |        var inputValue = value || this.state.value;
 | 
	
		
			
			| 432 | 452 |        var uploadFileList = fileList || this.state.fileList;
 | 
	
		
			
			| 433 | 453 |        var isLogin = app.currentUser && (app.currentUser.user_id > 0 || app.currentUser.id > 0);
 | 
	
		
			
			|  | 454 | +
 | 
	
		
			
			| 434 | 455 |        return _react2.default.createElement(
 | 
	
		
			
			| 435 | 456 |          "div",
 | 
	
		
			
			| 436 | 457 |          { className: "comment-editor-container", onPaste: this.handlePaste },
 | 
	
	
		
			
			|  | @@ -449,11 +470,12 @@ var Editor = function (_React$Component) {
 | 
	
		
			
			| 449 | 470 |              _react2.default.createElement(TextArea, {
 | 
	
		
			
			| 450 | 471 |                value: inputValue,
 | 
	
		
			
			| 451 | 472 |                onChange: function onChange(e) {
 | 
	
		
			
			| 452 |  | -                return _this4.handleChange(e.target.value);
 | 
	
		
			
			|  | 473 | +                _this4.handleChange(e.target.value);
 | 
	
		
			
			| 453 | 474 |                },
 | 
	
		
			
			| 454 | 475 |                rows: rows,
 | 
	
		
			
			| 455 | 476 |                placeholder: placeholder,
 | 
	
		
			
			| 456 |  | -              autoFocus: autoFocus
 | 
	
		
			
			|  | 477 | +              autoFocus: autoFocus,
 | 
	
		
			
			|  | 478 | +              onPressEnter: this.handlePressEnter
 | 
	
		
			
			| 457 | 479 |              }),
 | 
	
		
			
			| 458 | 480 |              _react2.default.createElement(
 | 
	
		
			
			| 459 | 481 |                "div",
 | 
	
	
		
			
			|  | @@ -628,7 +650,9 @@ Editor.propTypes = {
 | 
	
		
			
			| 628 | 650 |    imageToolIcon: _propTypes2.default.node,
 | 
	
		
			
			| 629 | 651 |    showError: _propTypes2.default.bool,
 | 
	
		
			
			| 630 | 652 |    onError: _propTypes2.default.func,
 | 
	
		
			
			| 631 |  | -  maxLength: _propTypes2.default.number
 | 
	
		
			
			|  | 653 | +  maxLength: _propTypes2.default.number,
 | 
	
		
			
			|  | 654 | +  // Enter事件相关
 | 
	
		
			
			|  | 655 | +  allowEnterSubmit: _propTypes2.default.bool
 | 
	
		
			
			| 632 | 656 |  };
 | 
	
		
			
			| 633 | 657 |  
 | 
	
		
			
			| 634 | 658 |  Editor.defaultProps = {
 | 
	
	
		
			
			|  | @@ -648,7 +672,9 @@ Editor.defaultProps = {
 | 
	
		
			
			| 648 | 672 |    showError: true,
 | 
	
		
			
			| 649 | 673 |    maxLength: 5000,
 | 
	
		
			
			| 650 | 674 |    app: {},
 | 
	
		
			
			| 651 |  | -  handleChangeFileList: function handleChangeFileList() {}
 | 
	
		
			
			|  | 675 | +  handleChangeFileList: function handleChangeFileList() {},
 | 
	
		
			
			|  | 676 | +  // Enter事件相关
 | 
	
		
			
			|  | 677 | +  allowEnterSubmit: false
 | 
	
		
			
			| 652 | 678 |  };
 | 
	
		
			
			| 653 | 679 |  
 | 
	
		
			
			| 654 | 680 |  exports.default = (0, _Comment2.default)(Editor);
 |