feat(core): Mixly.PagesManager中add方法允许使用Object对tab进行配置
This commit is contained in:
@@ -105,10 +105,12 @@ class App extends Component {
|
||||
this.#nav_ = new Nav();
|
||||
this.#nav_.mountOn($content.find('.mixly-nav'));
|
||||
this.#workspace_ = new Workspace($content.find('.mixly-workspace')[0]);
|
||||
this.#workspace_.getEditorsManager().getTabs().addTab({
|
||||
const editorsManager = this.#workspace_.getEditorsManager();
|
||||
editorsManager.add({
|
||||
type: '.mix',
|
||||
id: 'Untitled-1.mix',
|
||||
name: 'Untitled-1.mix',
|
||||
title: 'Untitled-1.mix',
|
||||
type: '.mix',
|
||||
favicon: 'fileicon-mix'
|
||||
});
|
||||
this.#footerbar_ = new FooterBar();
|
||||
|
||||
@@ -152,12 +152,19 @@ class PagesManager extends Component {
|
||||
return this.get(this.#activeId_);
|
||||
}
|
||||
|
||||
add(type, id, name = null, title = null, favicon = null) {
|
||||
this.#tabs_.addTab({
|
||||
name: name ?? id,
|
||||
title: title ?? id,
|
||||
type, favicon, id
|
||||
});
|
||||
add(...args) {
|
||||
if (args[0] && typeof args[0] === 'object') {
|
||||
this.#tabs_.addTab(args[0]);
|
||||
} else {
|
||||
const [type, id, name, title, favicon] = args;
|
||||
this.#tabs_.addTab({
|
||||
type,
|
||||
id,
|
||||
name: name ?? id,
|
||||
title: title ?? id,
|
||||
favicon
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
remove(id) {
|
||||
|
||||
@@ -200,7 +200,12 @@ class StatusBarsManager extends PagesManager {
|
||||
isHtmlName: true,
|
||||
name: ContextMenu.getItem(Msg.Lang['statusbar.ampy'], ''),
|
||||
callback: (key, opt) => {
|
||||
this.add('ampy', 'ampy', Msg.Lang['statusbar.ampy'], '');
|
||||
this.add({
|
||||
type: 'ampy',
|
||||
id: 'ampy',
|
||||
name: Msg.Lang['statusbar.ampy'],
|
||||
title: Msg.Lang['statusbar.ampy']
|
||||
});
|
||||
this.changeTo('ampy');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,12 @@ class Workspace extends Component {
|
||||
this.#$dragVRight_ = $content.find('.drag-v-right');
|
||||
this.#$dragH_ = $content.find('.drag-h');
|
||||
this.#statusBarsManager_ = new StatusBarsManager($content.find('.statusbars')[0]);
|
||||
this.#statusBarsManager_.add('terminal', 'output', Msg.Lang['statusbar.output']);
|
||||
this.#statusBarsManager_.add({
|
||||
type: 'terminal',
|
||||
id: 'output',
|
||||
name: Msg.Lang['statusbar.output'],
|
||||
title: Msg.Lang['statusbar.output']
|
||||
});
|
||||
this.#statusBarsManager_.changeTo('output');
|
||||
this.#editorsManager_ = new EditorsManager($content.find('.editors')[0]);
|
||||
this.#leftSideBarsManager_ = new LeftSideBarsManager($content.find('.left-sidebars')[0]);
|
||||
|
||||
Reference in New Issue
Block a user