|
|
@ -148,9 +148,9 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS |
|
|
|
|
|
|
|
|
|
|
|
runOnChange = () => { |
|
|
|
runOnChange = () => { |
|
|
|
const { onChange } = this.props; |
|
|
|
const { onChange } = this.props; |
|
|
|
|
|
|
|
const value = Plain.serialize(this.state.value); |
|
|
|
if (onChange) { |
|
|
|
if (onChange) { |
|
|
|
onChange(Plain.serialize(this.state.value)); |
|
|
|
onChange(this.cleanText(value)); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -190,6 +190,12 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS |
|
|
|
return next(); |
|
|
|
return next(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanText(text: string) { |
|
|
|
|
|
|
|
// RegExp with invisible characters we want to remove - currently only carriage return (newlines are visible)
|
|
|
|
|
|
|
|
const newText = text.trim().replace(/[\r]/g, ''); |
|
|
|
|
|
|
|
return newText; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const { disabled } = this.props; |
|
|
|
const { disabled } = this.props; |
|
|
|
const wrapperClassName = classnames('slate-query-field__wrapper', { |
|
|
|
const wrapperClassName = classnames('slate-query-field__wrapper', { |
|
|
|