Ver código fonte

Add: comments on handlePressEnter

Evo 4 anos atrás
pai
commit
25f5e26125
1 arquivos alterados com 4 adições e 12 exclusões
  1. 4
    12
      src/components/Editor/index.js

+ 4
- 12
src/components/Editor/index.js Ver arquivo

296
     return true;
296
     return true;
297
   }
297
   }
298
 
298
 
299
-  // allowInput = true;
300
-  // handleKeyDownWhenAllowEnter = e => {
301
-  //   const { allowEnter } = this.props;
302
-  //   // enter
303
-  //   if(allowEnter && e.keyCode === 13) {
304
-  //     // e.stopPropagation();
305
-  //     // return false;
306
-  //   }
307
-  //   // console.log("ee =>", e, typeof e.keyCode, e.ctrlKey);
308
-  // };
309
-
310
   /**
299
   /**
311
-   *
300
+   *  **处理Enter事件**
301
+   *  1. `allowEnter` & `onPressEnter`同时有效时才能触发
302
+   *  2. `e.preventDefault`为了防止enter事件后仍触发换行
303
+   *  3. enter事件开启,仍可以用`shift + enter`触发换行
312
    *  -- evo 20200222
304
    *  -- evo 20200222
313
    */
305
    */
314
   handlePressEnter = e => {
306
   handlePressEnter = e => {