Skip to content

Commit adc40be

Browse files
committed
Fixed mismatch displayed and transmitted query
1 parent b997ea0 commit adc40be

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

client/app.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)