mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
[sql lab] fix alt-enter runs out-of-date SQL (#2603)
This commit is contained in:
parent
db02b33e09
commit
6c68a21e4f
@ -62,12 +62,16 @@ class AceEditorWrapper extends React.PureComponent {
|
||||
onBlur() {
|
||||
this.props.onBlur(this.state.sql);
|
||||
}
|
||||
onAltEnter() {
|
||||
this.props.onBlur(this.state.sql);
|
||||
this.props.onAltEnter();
|
||||
}
|
||||
onEditorLoad(editor) {
|
||||
editor.commands.addCommand({
|
||||
name: 'runQuery',
|
||||
bindKey: { win: 'Alt-enter', mac: 'Alt-enter' },
|
||||
exec: () => {
|
||||
this.props.onAltEnter();
|
||||
this.onAltEnter();
|
||||
},
|
||||
});
|
||||
editor.$blockScrolling = Infinity; // eslint-disable-line no-param-reassign
|
||||
@ -76,6 +80,9 @@ class AceEditorWrapper extends React.PureComponent {
|
||||
this.props.queryEditor, editor.getSelectedText());
|
||||
});
|
||||
}
|
||||
getCompletions(aceEditor, session, pos, prefix, callback) {
|
||||
callback(null, this.state.words);
|
||||
}
|
||||
setAutoCompleter(props) {
|
||||
// Loading table and column names as auto-completable words
|
||||
let words = [];
|
||||
@ -101,9 +108,6 @@ class AceEditorWrapper extends React.PureComponent {
|
||||
}
|
||||
});
|
||||
}
|
||||
getCompletions(aceEditor, session, pos, prefix, callback) {
|
||||
callback(null, this.state.words);
|
||||
}
|
||||
textChange(text) {
|
||||
this.setState({ sql: text });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user