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 @@ -52,6 +52,8 @@ class QueryBox extends Component {
52
52
schema : undefined ,
53
53
codeMirrorTables : { }
54
54
} ;
55
+
56
+ this . codemirror = React . createRef ( ) ;
55
57
}
56
58
57
59
static getDerivedStateFromProps ( nextProps , prevState ) {
@@ -65,6 +67,18 @@ class QueryBox extends Component {
65
67
} ;
66
68
}
67
69
70
+ componentDidMount ( ) {
71
+ // IE or old browsers
72
+ if ( ! document . fonts || ! document . fonts . ready ) {
73
+ return ;
74
+ }
75
+
76
+ // we use custom font, codemirror needs refresh when the font is loaded
77
+ document . fonts . ready . then ( ( ) => {
78
+ this . codemirror . current . editor . refresh ( ) ;
79
+ } ) ;
80
+ }
81
+
68
82
static schemaToCodeMirror ( schema ) {
69
83
if ( ! schema ) {
70
84
return { } ;
@@ -105,6 +119,7 @@ class QueryBox extends Component {
105
119
< Row className = "codemirror-row no-spacing" >
106
120
< Col xs = { 12 } className = "codemirror-col no-spacing" >
107
121
< CodeMirror
122
+ ref = { this . codemirror }
108
123
value = { this . props . sql }
109
124
options = { options }
110
125
onBeforeChange = { ( editor , data , value ) => {
You can’t perform that action at this time.
0 commit comments