Syntax editor: AST string always shown, remove export button

This commit is contained in:
john.j.camilleri
2013-06-13 07:26:10 +00:00
parent f77e290f27
commit 8b46a3bbae
3 changed files with 24 additions and 24 deletions

View File

@@ -35,7 +35,7 @@ body.syntax-editor {
padding: 0.2em;
}
#tree
#tree, #tree_str
{
white-space:pre;
font-family: monospace;
@@ -69,6 +69,12 @@ body.syntax-editor {
font-weight: bold;
}
#tree_str
{
font-size:0.85em;
color:#666;
}
#refinements
{
/* display: inline-block; */

View File

@@ -33,6 +33,8 @@ function Editor(gm,opts) {
tree: div_id("tree"),
tree_str: div_id("tree_str"),
actionbar: div_id("actions"),
clear_button: button("Clear", function(){
t.clear_node();
@@ -55,6 +57,7 @@ function Editor(gm,opts) {
appendChildren(this.container, [
t.ui.menubar,
t.ui.tree,
t.ui.tree_str,
t.ui.actionbar,
t.ui.lin
]);
@@ -519,6 +522,7 @@ Editor.prototype.redraw_tree=function() {
}
with(this) {
clear(ui.tree);
ui.tree_str.innerText = ast.toString();
visit(ui.tree, new NodeID(), ast.root);
}
}
@@ -582,4 +586,3 @@ Editor.prototype.import_ast = function(abstr) {
};
t.server.pgf_call("abstrjson", args, cont, err);
}

View File

@@ -11,7 +11,6 @@ function EditorMenu(editor,opts) {
show_to_menu: true,
show_random_button: true,
show_import: true,
show_export: true,
}
// Apply supplied options
@@ -47,9 +46,7 @@ function EditorMenu(editor,opts) {
toggleHidden(t.ui.import.panel);
})
},
export_button: button("Export", function(){
alert(t.editor.ast.toString());
}),
debug_toggle: button("⚙", function(){
toggleHidden(element("debug"));
})
@@ -57,7 +54,6 @@ function EditorMenu(editor,opts) {
this.ui.to_toggle.title = "Select languages to linearise to (use Ctrl/Shift to select multiple)";
this.ui.random_button.title = "Insert a randomly generated tree at the current node";
this.ui.import.toggle.title = "Import an abstract syntax tree from a string (replaces current tree)";
this.ui.export_button.title = "Get the string representation of the abstract syntax tree";
this.ui.debug_toggle.title = "Toggle the debug console";
if (t.options.show_grammar_menu) {
@@ -95,11 +91,7 @@ function EditorMenu(editor,opts) {
t.ui.import.button
]);
}
if (t.options.show_export) {
appendChildren(t.container, [
t.ui.export_button,
]);
}
appendChildren(t.container, [t.ui.debug_toggle]);
/* --- Client state initialisation -------------------------------------- */
@@ -200,4 +192,3 @@ EditorMenu.prototype.update_language_menu=function(menu,grammar) {
}
}
}