Render value immediately (#15820)

This commit is contained in:
Geido 2021-07-22 20:46:01 +02:00 committed by GitHub
parent e660de6936
commit d4bec135e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,21 +62,27 @@ const defaultProps = {
export default class TextAreaControl extends React.Component { export default class TextAreaControl extends React.Component {
constructor() { constructor() {
super(); super();
this.state = {
value: '',
};
this.onAceChangeDebounce = debounce(value => { this.onAceChangeDebounce = debounce(value => {
this.onAceChange(value); this.onAceChange(value);
}, FAST_DEBOUNCE); }, FAST_DEBOUNCE);
} }
onControlChange(event) { onControlChange(event) {
this.props.onChange(event.target.value); const { value } = event.target;
this.setState({ value });
this.props.onChange(value);
} }
onAceChange(value) { onAceChange(value) {
this.setState({ value });
this.props.onChange(value); this.props.onChange(value);
} }
renderEditor(inModal = false) { renderEditor(inModal = false) {
const value = this.props.value || ''; const value = this.state.value || this.props.value;
const minLines = inModal ? 40 : this.props.minLines || 12; const minLines = inModal ? 40 : this.props.minLines || 12;
if (this.props.language) { if (this.props.language) {
const style = { border: '1px solid #CCC' }; const style = { border: '1px solid #CCC' };