File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,16 @@ class Editor extends React.Component {
2727 width : "100%" ,
2828 height : "400px"
2929 } ;
30+
3031 return (
3132 < div >
3233 < textarea ref = { ref => this . textareaNode = ref } style = { textareaStyle } > </ textarea >
3334 </ div >
3435 ) ;
3536 }
37+
3638 componentDidMount ( ) {
37- const options = {
39+ const codeMirror = CodeMirror . fromTextArea ( this . textareaNode , {
3840 mode : "application/sparql-query" ,
3941 matchBrackets : true ,
4042 autoCloseBrackets : true ,
@@ -46,13 +48,16 @@ class Editor extends React.Component {
4648 "Tab" : ( ) => false ,
4749 "Ctrl-Space" : ( ) => false ,
4850 }
49- } ;
51+ } ) ;
5052
51- this . codeMirror = CodeMirror . fromTextArea ( this . textareaNode , options ) ;
53+ const query = this . props . query ;
5254
53- if ( this . props . query !== null ) {
54- this . codeMirror . setValue ( this . props . query ) ;
55+ if ( query !== null ) {
56+ codeMirror . setValue ( query ) ;
5557 }
58+
59+ // force sparql-support to synchronize query buffers
60+ codeMirror . getWrapperElement ( ) . dispatchEvent ( new KeyboardEvent ( 'keydown' ) ) ;
5661 }
5762}
5863
You can’t perform that action at this time.
0 commit comments