File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -85,29 +85,34 @@ export default React.forwardRef<HTMLTextAreaElement, TextareaCodeEditorProps>((p
85
85
[ prefixCls , language , htmlStr ] ,
86
86
) ;
87
87
88
+ const change = ( evn : React . ChangeEvent < HTMLTextAreaElement > ) => {
89
+ setValue ( evn . target . value ) ;
90
+ onChange && onChange ( evn ) ;
91
+ } ;
92
+
93
+ const keyDown = ( evn : React . KeyboardEvent < HTMLTextAreaElement > ) => {
94
+ if ( other . readOnly ) return ;
95
+ if ( ! other . onKeyDown || other . onKeyDown ( evn ) !== false ) {
96
+ shortcuts ( evn ) ;
97
+ }
98
+ } ;
99
+
88
100
const textareaProps : React . TextareaHTMLAttributes < HTMLTextAreaElement > = {
89
101
autoComplete : 'off' ,
90
102
autoCorrect : 'off' ,
91
103
spellCheck : 'false' ,
92
104
autoCapitalize : 'off' ,
93
105
...other ,
94
106
placeholder,
95
- onKeyDown : ( evn ) => {
96
- if ( ! other . onKeyDown || other . onKeyDown ( evn ) !== false ) {
97
- shortcuts ( evn ) ;
98
- }
99
- } ,
107
+ onKeyDown : keyDown ,
100
108
style : {
101
109
...styles . editor ,
102
110
...styles . textarea ,
103
111
...contentStyle ,
104
112
minHeight,
105
113
...( placeholder && ! value ? { WebkitTextFillColor : 'inherit' } : { } ) ,
106
114
} ,
107
- onChange : ( evn ) => {
108
- setValue ( evn . target . value ) ;
109
- onChange && onChange ( evn ) ;
110
- } ,
115
+ onChange : change ,
111
116
className : `${ prefixCls } -text` ,
112
117
value : value ,
113
118
} ;
You can’t perform that action at this time.
0 commit comments