mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-17 00:39:32 -06:00
syntax editor + minibar: fix bug with repeated switching back and forth
By avoiding "this" in callback functions, the code can be kept cleaner.
This commit is contained in:
@@ -41,7 +41,6 @@ function Minibar(server,opts) {
|
|||||||
|
|
||||||
/* --- Creating the components of the minibar --------------------------- */
|
/* --- Creating the components of the minibar --------------------------- */
|
||||||
this.translations=new Translations(server,this.options)
|
this.translations=new Translations(server,this.options)
|
||||||
this.translations.minibar=this; // ref to parent
|
|
||||||
this.input=new Input(server,this.translations,this.options)
|
this.input=new Input(server,this.translations,this.options)
|
||||||
|
|
||||||
/* --- Creating user interface elements --------------------------------- */
|
/* --- Creating user interface elements --------------------------------- */
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ Translations.prototype.show_translations=function(translationResults) {
|
|||||||
var tbody=empty("tbody");
|
var tbody=empty("tbody");
|
||||||
if(options.show_abstract && t.tree) {
|
if(options.show_abstract && t.tree) {
|
||||||
function abs_act() {
|
function abs_act() {
|
||||||
var minibar = self.minibar;
|
self.options.abstract_action(t.tree)
|
||||||
bind(self.options.abstract_action,minibar)(t.tree)
|
|
||||||
}
|
}
|
||||||
var abs_hdr = options.abstract_action
|
var abs_hdr = options.abstract_action
|
||||||
? button("Abstract",abs_act)
|
? button("Abstract",abs_act)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ if(window.Minibar) // Minibar loaded?
|
|||||||
},
|
},
|
||||||
// get us back to the editor!
|
// get us back to the editor!
|
||||||
abstract_action: function(tree) {
|
abstract_action: function(tree) {
|
||||||
var minibar=this;
|
//var minibar=this;
|
||||||
// how to get hold of new minibar?
|
// how to get hold of new minibar?
|
||||||
var editor_options = {
|
var editor_options = {
|
||||||
target: "editor",
|
target: "editor",
|
||||||
@@ -45,13 +45,14 @@ if(window.Minibar) // Minibar loaded?
|
|||||||
abstr: tree
|
abstr: tree
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
minibar.hide();
|
editor.minibar.hide();
|
||||||
minibar.editor.show();
|
editor.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editor.hide();
|
editor.hide();
|
||||||
editor.minibar=new Minibar(server,minibar_options);
|
editor.minibar=new Minibar(server,minibar_options);
|
||||||
editor.minibar.editor = editor; // :S
|
//editor.minibar.editor = editor; // :S
|
||||||
|
editor.minibar.show()
|
||||||
}
|
}
|
||||||
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