fix(textarea-control): ace editor input exception (#18146)
This commit is contained in:
parent
2dd64f9a93
commit
7bb867407a
|
|
@ -63,6 +63,10 @@ export default class TextAreaControl extends React.Component {
|
|||
this.props.onChange(value);
|
||||
}
|
||||
|
||||
onAreaEditorChange(value) {
|
||||
this.props.onChange(value);
|
||||
}
|
||||
|
||||
renderEditor(inModal = false) {
|
||||
const minLines = inModal ? 40 : this.props.minLines || 12;
|
||||
if (this.props.language) {
|
||||
|
|
@ -76,7 +80,6 @@ export default class TextAreaControl extends React.Component {
|
|||
style={style}
|
||||
minLines={minLines}
|
||||
maxLines={inModal ? 1000 : this.props.maxLines}
|
||||
onChange={this.props.onChange}
|
||||
width="100%"
|
||||
height={`${minLines}em`}
|
||||
editorProps={{ $blockScrolling: true }}
|
||||
|
|
@ -84,6 +87,7 @@ export default class TextAreaControl extends React.Component {
|
|||
readOnly={this.props.readOnly}
|
||||
key={this.props.name}
|
||||
{...this.props}
|
||||
onChange={this.onAreaEditorChange.bind(this)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,4 +54,12 @@ describe('TextArea', () => {
|
|||
expect(wrapper.find(TextArea)).not.toExist();
|
||||
expect(wrapper.find(TextAreaEditor)).toExist();
|
||||
});
|
||||
|
||||
it('calls onAreaEditorChange when entering in the AceEditor', () => {
|
||||
const props = { ...defaultProps };
|
||||
props.language = 'markdown';
|
||||
wrapper = shallow(<TextAreaControl {...props} />);
|
||||
wrapper.simulate('change', { target: { value: 'x' } });
|
||||
expect(defaultProps.onChange.calledWith('x')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue