mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
Syntax editor: return to editor after having switched to minibar
This commit is contained in:
@@ -9,7 +9,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body class=syntax_editor>
|
<body class=syntax_editor>
|
||||||
<h2>Syntax Editor</h2>
|
<h2>Syntax Editor</h2>
|
||||||
<div id="editor" class="test"></div>
|
<div id=minibar></div>
|
||||||
|
<div id=editor></div>
|
||||||
<noscript>This page doesn't works unless JavaScript is enabled.</noscript>
|
<noscript>This page doesn't works unless JavaScript is enabled.</noscript>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ function Editor(server,opts) {
|
|||||||
clear(this.container);
|
clear(this.container);
|
||||||
this.container.classList.remove("editor");
|
this.container.classList.remove("editor");
|
||||||
}
|
}
|
||||||
|
this.hide = function() {
|
||||||
|
this.container.style.display="none";
|
||||||
|
}
|
||||||
|
this.show = function() {
|
||||||
|
this.container.style.display="block";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +249,7 @@ Editor.prototype.update_linearisation=function(){
|
|||||||
function row(lang, lin) {
|
function row(lang, lin) {
|
||||||
var langname = langpart(lang, t.grammar.name);
|
var langname = langpart(lang, t.grammar.name);
|
||||||
var btn = button(langname, function(){
|
var btn = button(langname, function(){
|
||||||
t.options.lin_action(lin,lang);
|
bind(t.options.lin_action,t)(lin,lang);
|
||||||
});
|
});
|
||||||
var c1 = th(btn);
|
var c1 = th(btn);
|
||||||
var c2 = td(text(lin));
|
var c2 = td(text(lin));
|
||||||
|
|||||||
@@ -20,21 +20,38 @@ var editor_options = {
|
|||||||
}
|
}
|
||||||
if(window.Minibar) // Minibar loaded?
|
if(window.Minibar) // Minibar loaded?
|
||||||
editor_options.lin_action=function(s,langFrom) {
|
editor_options.lin_action=function(s,langFrom) {
|
||||||
editor.shutdown();
|
var editor=this;
|
||||||
var minibar_options = {
|
var minibar_options = {
|
||||||
target: "editor",
|
target: "minibar",
|
||||||
show_abstract: true,
|
show_abstract: true,
|
||||||
show_trees: true,
|
show_trees: true,
|
||||||
show_grouped_translations: false,
|
show_grouped_translations: false,
|
||||||
show_brackets: true,
|
show_brackets: true,
|
||||||
word_replacements: true,
|
word_replacements: true,
|
||||||
initial_grammar: editor.menu.ui.grammar_menu.value, // hmm
|
initial_grammar: editor.menu.ui.grammar_menu.value, // hmm
|
||||||
initial: {
|
initial: {
|
||||||
from: langFrom,
|
from: langFrom,
|
||||||
input: s.split(" ") // is it that easy?
|
input: s.split(" ") // is it that easy?
|
||||||
}
|
},
|
||||||
}
|
// get us back to the editor!
|
||||||
editor.minibar=new Minibar(server,minibar_options);
|
abstract_action: function(tree) {
|
||||||
|
var minibar=this;
|
||||||
|
// how to get hold of new minibar?
|
||||||
|
var editor_options = {
|
||||||
|
target: "editor",
|
||||||
|
initial: {
|
||||||
|
grammar: editor.minibar.grammar_menu.value, // hmm
|
||||||
|
startcat: editor.minibar.input.startcat_menu.value, // hmm
|
||||||
|
abstr: tree
|
||||||
|
}
|
||||||
|
}
|
||||||
|
minibar.hide();
|
||||||
|
minibar.editor.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
editor.hide();
|
||||||
|
editor.minibar=new Minibar(server,minibar_options);
|
||||||
|
editor.minibar.editor = editor; // :S
|
||||||
}
|
}
|
||||||
if(/^\?\/tmp\//.test(location.search)) {
|
if(/^\?\/tmp\//.test(location.search)) {
|
||||||
var args=decodeURIComponent(location.search.substr(1)).split(" ")
|
var args=decodeURIComponent(location.search.substr(1)).split(" ")
|
||||||
|
|||||||
Reference in New Issue
Block a user