From cd681b41e4a54a12f162af1535a9d36a85af2e28 Mon Sep 17 00:00:00 2001 From: Diego Medina Date: Thu, 31 Mar 2022 19:05:00 -0400 Subject: [PATCH] feat(sql lab): enable ACE editor search in SQL editors (#19328) (cherry picked from commit eab9388f7cdaca20588d4c94c929225fd9d59870) --- .../src/SqlLab/components/AceEditorWrapper/index.tsx | 2 -- superset-frontend/src/components/AsyncAceEditor/index.tsx | 4 +++- superset-frontend/src/types/brace.d.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index 25da49137ad60..35722ba866066 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -127,8 +127,6 @@ class AceEditorWrapper extends React.PureComponent { } onEditorLoad(editor: any) { - editor.commands.removeCommand('find'); - editor.commands.addCommand({ name: 'runQuery', bindKey: { win: 'Alt-enter', mac: 'Alt-enter' }, diff --git a/superset-frontend/src/components/AsyncAceEditor/index.tsx b/superset-frontend/src/components/AsyncAceEditor/index.tsx index 6d4619b32609d..521ae357bed31 100644 --- a/superset-frontend/src/components/AsyncAceEditor/index.tsx +++ b/superset-frontend/src/components/AsyncAceEditor/index.tsx @@ -68,6 +68,7 @@ const aceModuleLoaders = { 'theme/textmate': () => import('brace/theme/textmate'), 'theme/github': () => import('brace/theme/github'), 'ext/language_tools': () => import('brace/ext/language_tools'), + 'ext/searchbox': () => import('brace/ext/searchbox'), }; export type AceModule = keyof typeof aceModuleLoaders; @@ -164,10 +165,11 @@ export const SQLEditor = AsyncAceEditor([ 'mode/sql', 'theme/github', 'ext/language_tools', + 'ext/searchbox', ]); export const FullSQLEditor = AsyncAceEditor( - ['mode/sql', 'theme/github', 'ext/language_tools'], + ['mode/sql', 'theme/github', 'ext/language_tools', 'ext/searchbox'], { // a custom placeholder in SQL lab for less jumpy re-renders placeholder: () => { diff --git a/superset-frontend/src/types/brace.d.ts b/superset-frontend/src/types/brace.d.ts index 70d9275e41d4f..0b3770eebede6 100644 --- a/superset-frontend/src/types/brace.d.ts +++ b/superset-frontend/src/types/brace.d.ts @@ -26,3 +26,4 @@ declare module 'brace/mode/javascript'; declare module 'brace/theme/textmate'; declare module 'brace/theme/github'; declare module 'brace/ext/language_tools'; +declare module 'brace/ext/searchbox';