|
|
|
|
@ -13,32 +13,6 @@ export default class TabCachingWidget extends TabAwareWidget {
|
|
|
|
|
return this.$widget = $(`<div class="marker" style="display: none;">`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleEventInChildren(name, data) {
|
|
|
|
|
// stop propagation of the event to the children, individual tab widget should not know about tab switching
|
|
|
|
|
// since they are per-tab
|
|
|
|
|
if (name === 'tabNoteSwitchedAndActivated') {
|
|
|
|
|
name = 'tabNoteSwitched';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (name === 'tabNoteSwitched') {
|
|
|
|
|
// this event is propagated only to the widgets of a particular tab
|
|
|
|
|
const widget = this.widgets[data.tabContext.tabId];
|
|
|
|
|
|
|
|
|
|
if (widget) {
|
|
|
|
|
return widget.handleEvent(name, data);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (name !== 'activeTabChanged') {
|
|
|
|
|
return super.handleEventInChildren(name, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async newTabOpenedEvent({tabContext}) {
|
|
|
|
|
const {tabId} = tabContext;
|
|
|
|
|
|
|
|
|
|
@ -49,7 +23,7 @@ export default class TabCachingWidget extends TabAwareWidget {
|
|
|
|
|
this.widgets[tabId] = this.widgetFactory();
|
|
|
|
|
|
|
|
|
|
const $renderedWidget = this.widgets[tabId].render();
|
|
|
|
|
this.widgets[tabId].toggleExt(this.widgets[tabId]);
|
|
|
|
|
this.widgets[tabId].toggleExt(this.isTab(tabId));
|
|
|
|
|
|
|
|
|
|
this.$widget.after($renderedWidget);
|
|
|
|
|
|
|
|
|
|
@ -60,14 +34,6 @@ export default class TabCachingWidget extends TabAwareWidget {
|
|
|
|
|
this.child(this.widgets[tabId]); // add as child only once it is ready (rendered with tabContext)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async refresh() {
|
|
|
|
|
const activeTabId = this.tabContext && this.tabContext.tabId;
|
|
|
|
|
|
|
|
|
|
for (const tabId in this.widgets) {
|
|
|
|
|
this.widgets[tabId].toggleExt(tabId === activeTabId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tabRemovedEvent({tabId}) {
|
|
|
|
|
const widget = this.widgets[tabId];
|
|
|
|
|
|
|
|
|
|
@ -79,11 +45,41 @@ export default class TabCachingWidget extends TabAwareWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async refresh() {
|
|
|
|
|
this.toggleExt(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleInt(show) {} // not needed
|
|
|
|
|
|
|
|
|
|
toggleByTab(show) {
|
|
|
|
|
toggleExt(show) {
|
|
|
|
|
for (const tabId in this.widgets) {
|
|
|
|
|
this.widgets[tabId].toggleExt(show && this.isTab(tabId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleEventInChildren(name, data) {
|
|
|
|
|
// stop propagation of the event to the children, individual tab widget should not know about tab switching
|
|
|
|
|
// since they are per-tab
|
|
|
|
|
if (name === 'tabNoteSwitchedAndActivated') {
|
|
|
|
|
name = 'tabNoteSwitched';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (name === 'tabNoteSwitched') {
|
|
|
|
|
// this event is propagated only to the widgets of a particular tab
|
|
|
|
|
const widget = this.widgets[data.tabContext.tabId];
|
|
|
|
|
|
|
|
|
|
if (widget) {
|
|
|
|
|
return widget.handleEvent(name, data);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (name !== 'activeTabChanged') {
|
|
|
|
|
return super.handleEventInChildren(name, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|