33 lines
No EOL
806 B
JavaScript
33 lines
No EOL
806 B
JavaScript
var atlasEditor = ace.edit("atlas-config-editor");
|
|
atlasEditor.setTheme("ace/theme/monokai");
|
|
atlasEditor.session.setMode("ace/mode/text");
|
|
atlasEditor.session.setUseWrapMode(true);
|
|
|
|
var jsonEditor = ace.edit("json-config-editor");
|
|
jsonEditor.setTheme("ace/theme/monokai");
|
|
jsonEditor.session.setMode("ace/mode/json");
|
|
|
|
var parser;
|
|
|
|
$.get('js/atlas.pegjs', function (data) {
|
|
parser = PEG.buildParser(data);
|
|
});
|
|
|
|
ko.applyBindings({});
|
|
|
|
function fromAtlasToJson() {
|
|
var input = atlasEditor.getValue();
|
|
var output = parser.parse(input);
|
|
jsonEditor.setValue(ko.toJSON(output, null, 2));
|
|
}
|
|
|
|
function fromJsonToAtlas() {
|
|
var input = JSON.parse(jsonEditor.getValue());
|
|
|
|
console.log(input);
|
|
|
|
var output = deparseJson(input);
|
|
|
|
console.log(output);
|
|
atlasEditor.setValue(output);
|
|
} |