File tree 1 file changed +15
-0
lines changed 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ class QueryBox extends Component {
22
22
schema : undefined ,
23
23
codeMirrorTables : { }
24
24
} ;
25
+
26
+ this . codemirror = React . createRef ( ) ;
25
27
}
26
28
27
29
static getDerivedStateFromProps ( nextProps , prevState ) {
@@ -35,6 +37,18 @@ class QueryBox extends Component {
35
37
} ;
36
38
}
37
39
40
+ componentDidMount ( ) {
41
+ // IE or old browsers
42
+ if ( ! document . fonts || ! document . fonts . ready ) {
43
+ return ;
44
+ }
45
+
46
+ // we use custom font, codemirror needs refresh when the font is loaded
47
+ document . fonts . ready . then ( ( ) => {
48
+ this . codemirror . current . editor . refresh ( ) ;
49
+ } ) ;
50
+ }
51
+
38
52
static schemaToCodeMirror ( schema ) {
39
53
if ( ! schema ) {
40
54
return { } ;
@@ -85,6 +99,7 @@ class QueryBox extends Component {
85
99
< Row className = "codemirror-row no-spacing" >
86
100
< Col xs = { 12 } className = "codemirror-col no-spacing" >
87
101
< CodeMirror
102
+ ref = { this . codemirror }
88
103
value = { this . props . sql }
89
104
options = { options }
90
105
onBeforeChange = { ( editor , data , value ) => {
You can’t perform that action at this time.
0 commit comments