16
16
* specific language governing permissions and limitations
17
17
* under the License.
18
18
*/
19
- import { useEffect , useState } from 'react' ;
20
- import { Popover , type PopoverProps } from '@superset-ui/core/components' ;
21
- import type ReactAce from 'react-ace' ;
19
+ import {
20
+ Popover ,
21
+ type PopoverProps ,
22
+ SQLEditor ,
23
+ } from '@superset-ui/core/components' ;
22
24
import { CalculatorOutlined } from '@ant-design/icons' ;
23
25
import { css , styled , useTheme , t } from '@superset-ui/core' ;
24
26
@@ -35,24 +37,10 @@ const StyledCalculatorIcon = styled(CalculatorOutlined)`
35
37
36
38
export const SQLPopover = ( props : PopoverProps & { sqlExpression : string } ) => {
37
39
const theme = useTheme ( ) ;
38
- const [ AceEditor , setAceEditor ] = useState < typeof ReactAce | null > ( null ) ;
39
- useEffect ( ( ) => {
40
- Promise . all ( [
41
- import ( 'react-ace' ) ,
42
- import ( 'ace-builds/src-min-noconflict/mode-sql' ) ,
43
- ] ) . then ( ( [ reactAceModule ] ) => {
44
- setAceEditor ( ( ) => reactAceModule . default ) ;
45
- } ) ;
46
- } , [ ] ) ;
47
-
48
- if ( ! AceEditor ) {
49
- return null ;
50
- }
51
40
return (
52
41
< Popover
53
42
content = {
54
- < AceEditor
55
- mode = "sql"
43
+ < SQLEditor
56
44
value = { props . sqlExpression }
57
45
editorProps = { { $blockScrolling : true } }
58
46
setOptions = { {
@@ -65,7 +53,6 @@ export const SQLPopover = (props: PopoverProps & { sqlExpression: string }) => {
65
53
wrapEnabled
66
54
style = { {
67
55
border : `1px solid ${ theme . colorBorder } ` ,
68
- background : theme . colorPrimaryBg ,
69
56
maxWidth : theme . sizeUnit * 100 ,
70
57
} }
71
58
/>
0 commit comments