|
@@ -51,6 +51,12 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ _ws.events.on('rendered:tabs', function() {
|
|
|
|
|
+ console.log('rebind editor tabs');
|
|
|
|
|
+ $tabItems = $('#tabs li');
|
|
|
|
|
+ bindEditorTabs();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
if(_ws.files.length === 0) {
|
|
if(_ws.files.length === 0) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -95,20 +101,22 @@ $(document).ready(function() {
|
|
|
/**
|
|
/**
|
|
|
* File list tabs click handler
|
|
* File list tabs click handler
|
|
|
*/
|
|
*/
|
|
|
- $tabItems.click(function() {
|
|
|
|
|
- var clickedItem = $(this);
|
|
|
|
|
- var type = clickedItem.data('type');
|
|
|
|
|
- editorSession.setMode("ace/mode/" + mapTypes[type]);
|
|
|
|
|
- var name = clickedItem.html();
|
|
|
|
|
- var file = _ws.files.find(f => (f.name === name));
|
|
|
|
|
- editorSession.setValue(file.content);
|
|
|
|
|
- // saveToLocalStorage();
|
|
|
|
|
- // var mode = $(this).prop('id').substr(5);
|
|
|
|
|
- // console.log( .html() );
|
|
|
|
|
- // setActiveTab(mode);
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
|
|
+ function bindEditorTabs() {
|
|
|
|
|
+ $tabItems.click(function() {
|
|
|
|
|
+ var clickedItem = $(this);
|
|
|
|
|
+ var type = clickedItem.data('type');
|
|
|
|
|
+ editorSession.setMode("ace/mode/" + mapTypes[type]);
|
|
|
|
|
+ var name = clickedItem.html();
|
|
|
|
|
+ var file = _ws.files.find(f => (f.name === name));
|
|
|
|
|
+ editorSession.setValue(file.content);
|
|
|
|
|
+ // saveToLocalStorage();
|
|
|
|
|
+ // var mode = $(this).prop('id').substr(5);
|
|
|
|
|
+ // console.log( .html() );
|
|
|
|
|
+ // setActiveTab(mode);
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ bindEditorTabs();
|
|
|
|
|
|
|
|
|
|
|
|
|
// /**
|
|
// /**
|