| 
				
			 | 
			
			
				@@ -60,6 +60,7 @@ class Editor extends React.Component { 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				60
			 | 
			
			
				       fileMap: {}, // 已经上传的图片路径和 uid 的映射 { uid: path } 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				61
			 | 
			
			
				       uploadVisible: false 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				62
			 | 
			
			
				     }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+    this.handleChange = this.handleChange.bind(this); 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				64
			 | 
			
			
				     this.handleClickEmoji = this.handleClickEmoji.bind(this); 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				65
			 | 
			
			
				     this.handleChangeFileList = this.handleChangeFileList.bind(this); 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				66
			 | 
			
			
				     this.handleShowUpload = this.handleShowUpload.bind(this); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -68,10 +69,11 @@ class Editor extends React.Component { 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				69
			 | 
			
			
				     this.handlePaste = this.handlePaste.bind(this); 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				70
			 | 
			
			
				     this.resetState = this.resetState.bind(this); 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				71
			 | 
			
			
				     this.handleEmojiScroll = this.handleEmojiScroll.bind(this); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				+    this.handlePressEnter = this.handlePressEnter.bind(this); 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				73
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				74
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				73
			 | 
			
				75
			 | 
			
			
				   componentDidMount() { 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				
			 | 
			
			
				-    const { app, onRef, allowEnter, onPressEnter } = this.props; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+    const { app, onRef } = this.props; 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				77
			 | 
			
			
				     if ( 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				78
			 | 
			
			
				       app.currentUser && 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				79
			 | 
			
			
				       (app.currentUser.user_id > 0 || app.currentUser.id > 0) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -81,9 +83,6 @@ class Editor extends React.Component { 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				83
			 | 
			
			
				     if (isFunction(onRef)) { 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				84
			 | 
			
			
				       onRef(this); 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				85
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				
			 | 
			
			
				-    if ((allowEnter && !onPressEnter) || (!allowEnter && onPressEnter)) 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				
			 | 
			
			
				-      console.error("`onPressEnter` must be undefined when `allowEnter`!"); 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				86
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				87
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				89
			 | 
			
				88
			 | 
			
			
				   handleEmojiScroll(e) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -103,12 +102,12 @@ class Editor extends React.Component { 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				102
			 | 
			
			
				    * 将最新的值存储到 state 中 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				103
			 | 
			
			
				    * @param {string} value 输入的值 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				104
			 | 
			
			
				    */ 
			 | 
		
	
		
			
			| 
				106
			 | 
			
				
			 | 
			
			
				-  handleChange = value => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				105
			 | 
			
			
				+  handleChange(value) { 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				106
			 | 
			
			
				     this.setState({ value }); 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				107
			 | 
			
			
				     if (this.props.onChange) { 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				108
			 | 
			
			
				       this.props.onChange(value); 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				109
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				
			 | 
			
			
				-  }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				110
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				112
			 | 
			
				111
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				113
			 | 
			
				112
			 | 
			
			
				   /** 
			 | 
		
	
		
			
			| 
				114
			 | 
			
				113
			 | 
			
			
				    * 点击 emoji 的事件 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -298,20 +297,19 @@ class Editor extends React.Component { 
			 | 
		
	
		
			
			| 
				298
			 | 
			
				297
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				299
			 | 
			
				298
			 | 
			
			
				   /** 
			 | 
		
	
		
			
			| 
				300
			 | 
			
				299
			 | 
			
			
				    *  **处理Enter事件** 
			 | 
		
	
		
			
			| 
				301
			 | 
			
				
			 | 
			
			
				-   *  1. `allowEnter` & `onPressEnter`同时有效时才能触发 
			 | 
		
	
		
			
			| 
				
			 | 
			
				300
			 | 
			
			
				+   *  1. `allowEnterSubmit`为true时enter触发submit事件 
			 | 
		
	
		
			
			| 
				302
			 | 
			
				301
			 | 
			
			
				    *  2. `e.preventDefault`为了防止enter事件后仍触发换行 
			 | 
		
	
		
			
			| 
				303
			 | 
			
				
			 | 
			
			
				-   *  3. enter事件开启,仍可以用`shift + enter`触发换行 
			 | 
		
	
		
			
			| 
				
			 | 
			
				302
			 | 
			
			
				+   *  3. enter事件开启后,仍可以用`shift + enter`触发换行 
			 | 
		
	
		
			
			| 
				304
			 | 
			
				303
			 | 
			
			
				    *  -- evo 20200222 
			 | 
		
	
		
			
			| 
				305
			 | 
			
				304
			 | 
			
			
				    */ 
			 | 
		
	
		
			
			| 
				306
			 | 
			
				
			 | 
			
			
				-  handlePressEnter = e => { 
			 | 
		
	
		
			
			| 
				307
			 | 
			
				
			 | 
			
			
				-    const { allowEnter, onPressEnter } = this.props; 
			 | 
		
	
		
			
			| 
				308
			 | 
			
				
			 | 
			
			
				-    if (allowEnter && onPressEnter) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				305
			 | 
			
			
				+  handlePressEnter(e) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				306
			 | 
			
			
				+    if (this.props.allowEnterSubmit) { 
			 | 
		
	
		
			
			| 
				309
			 | 
			
				307
			 | 
			
			
				       if (!e.shiftKey) { 
			 | 
		
	
		
			
			| 
				310
			 | 
			
				308
			 | 
			
			
				         e.preventDefault(); 
			 | 
		
	
		
			
			| 
				311
			 | 
			
				
			 | 
			
			
				-        onPressEnter(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				309
			 | 
			
			
				+        this.handleSubmit(); 
			 | 
		
	
		
			
			| 
				312
			 | 
			
				310
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				313
			 | 
			
				311
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				314
			 | 
			
				
			 | 
			
			
				-  }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				312
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				315
			 | 
			
				313
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				316
			 | 
			
				314
			 | 
			
			
				   render() { 
			 | 
		
	
		
			
			| 
				317
			 | 
			
				315
			 | 
			
			
				     const { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -530,8 +528,7 @@ Editor.propTypes = { 
			 | 
		
	
		
			
			| 
				530
			 | 
			
				528
			 | 
			
			
				   onError: PropTypes.func, 
			 | 
		
	
		
			
			| 
				531
			 | 
			
				529
			 | 
			
			
				   maxLength: PropTypes.number, 
			 | 
		
	
		
			
			| 
				532
			 | 
			
				530
			 | 
			
			
				   // Enter事件相关 
			 | 
		
	
		
			
			| 
				533
			 | 
			
				
			 | 
			
			
				-  allowEnter: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				534
			 | 
			
				
			 | 
			
			
				-  onPressEnter: PropTypes.func 
			 | 
		
	
		
			
			| 
				
			 | 
			
				531
			 | 
			
			
				+  allowEnterSubmit: PropTypes.bool 
			 | 
		
	
		
			
			| 
				535
			 | 
			
				532
			 | 
			
			
				 }; 
			 | 
		
	
		
			
			| 
				536
			 | 
			
				533
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				537
			 | 
			
				534
			 | 
			
			
				 Editor.defaultProps = { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -553,8 +550,7 @@ Editor.defaultProps = { 
			 | 
		
	
		
			
			| 
				553
			 | 
			
				550
			 | 
			
			
				   app: {}, 
			 | 
		
	
		
			
			| 
				554
			 | 
			
				551
			 | 
			
			
				   handleChangeFileList: () => {}, 
			 | 
		
	
		
			
			| 
				555
			 | 
			
				552
			 | 
			
			
				   // Enter事件相关 
			 | 
		
	
		
			
			| 
				556
			 | 
			
				
			 | 
			
			
				-  allowEnter: false, 
			 | 
		
	
		
			
			| 
				557
			 | 
			
				
			 | 
			
			
				-  onPressEnter: undefined 
			 | 
		
	
		
			
			| 
				
			 | 
			
				553
			 | 
			
			
				+  allowEnterSubmit: false 
			 | 
		
	
		
			
			| 
				558
			 | 
			
				554
			 | 
			
			
				 }; 
			 | 
		
	
		
			
			| 
				559
			 | 
			
				555
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				560
			 | 
			
				556
			 | 
			
			
				 export default Comment(Editor); 
			 |