fix: enable find text browser functionality inside SQL Lab editor (#19061)

This commit is contained in:
Diego Medina 2022-03-09 14:27:10 -05:00 committed by GitHub
parent bd76648e4e
commit fd757c4aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -121,6 +121,8 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
}
onEditorLoad(editor: any) {
editor.commands.removeCommand('find');
editor.commands.addCommand({
name: 'runQuery',
bindKey: { win: 'Alt-enter', mac: 'Alt-enter' },
@ -128,6 +130,7 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
this.onAltEnter();
},
});
this.props.hotkeys.forEach(keyConfig => {
editor.commands.addCommand({
name: keyConfig.name,
@ -135,6 +138,7 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
exec: keyConfig.func,
});
});
editor.$blockScrolling = Infinity; // eslint-disable-line no-param-reassign
editor.selection.on('changeSelection', () => {
const selectedText = editor.getSelectedText();