Scaffold: Focus code editor when selecting tab
This commit is contained in:
parent
2ed4bb1c8f
commit
018f04f369
2 changed files with 14 additions and 2 deletions
|
@ -428,7 +428,19 @@ var Scaffold = new function() {
|
|||
yield Zotero.Translators.reinit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.handleTabSelect = function (event) {
|
||||
// Focus editor when switching to tab
|
||||
var tab = event.target.selectedItem.id.match(/^tab-(.+)$/)[1];
|
||||
switch (tab) {
|
||||
case 'import':
|
||||
case 'code':
|
||||
case 'tests':
|
||||
_editors[tab].focus();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* add template code
|
||||
*/
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
</toolbar>
|
||||
<hbox flex="1">
|
||||
<tabbox id="left-tabbox" flex="1" width="300">
|
||||
<tabs id="tabs">
|
||||
<tabs id="tabs" onselect="Scaffold.handleTabSelect(event)">
|
||||
<tab id="tab-metadata" label="&scaffold.tabs.metadata.label;"/>
|
||||
<tab id="tab-code" label="&scaffold.tabs.code.label;"/>
|
||||
<tab id="tab-import" label="&scaffold.tabs.import.label;"/>
|
||||
|
|
Loading…
Reference in a new issue