diff --git a/superset/assets/javascripts/SqlLab/components/AceEditorWrapper.jsx b/superset/assets/javascripts/SqlLab/components/AceEditorWrapper.jsx index 24e9e25db630c..9a9b0379922c3 100644 --- a/superset/assets/javascripts/SqlLab/components/AceEditorWrapper.jsx +++ b/superset/assets/javascripts/SqlLab/components/AceEditorWrapper.jsx @@ -37,10 +37,12 @@ const propTypes = { descr: PropTypes.string.isRequired, func: PropTypes.func.isRequired, })), + onChange: PropTypes.func, }; const defaultProps = { onBlur: () => {}, + onChange: () => {}, tables: [], }; @@ -51,6 +53,7 @@ class AceEditorWrapper extends React.PureComponent { sql: props.sql, selectedText: '', }; + this.onChange = this.onChange.bind(this); } componentDidMount() { // Making sure no text is selected from previous mount @@ -97,6 +100,10 @@ class AceEditorWrapper extends React.PureComponent { } }); } + onChange(text) { + this.setState({ sql: text }); + this.props.onChange(text); + } getCompletions(aceEditor, session, pos, prefix, callback) { callback(null, this.state.words); } @@ -125,9 +132,6 @@ class AceEditorWrapper extends React.PureComponent { } }); } - textChange(text) { - this.setState({ sql: text }); - } render() { return (