Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 151
Tab API
hackape edited this page Jul 19, 2017
·
4 revisions
Tab is the data model for a tab view inside a pane.
interfaceTab{title: string// title of tab, default to "untitled", if has file, then it'll be the file nameeditor: Editor// editor instance attach to tabfile: File// shortcut to this.editor.fileindex: number// index of tab in tabGroupflags: $mobx// tab flags, a simple observable objecttabGroup: TabGroup// getter returns it's parentisActive: boolean// active status of this tab in tabGroupsiblings: Tab[]// return siblings tabs including itself in its tabGroupprev: Tabnext: Tab// previous/next tab in tabGroupgetAdjacent(checkNextFirst: boolean): Tab;// whenever it's possible, return an adjacent tab without specifying prev or nextactivate(): void// activate the tab and the containing tabGroupdestroy(): void// remove this tab by invoking `tabGroup.remove(this)` and delete it from state.tabs}TabStore is the manager to tab related business. It serves as an access point for all tab related data and actions.
interfaceTabStore{createTab(tabProps): void// new Tab(tabProps)removeTab(tabId: string): void// tab.destroy()removeOtherTab(tabId: string): void// activate given tab and close others from tabGroup// @fixme: the name's misleadingremoveAllTab(tabId: string): void// get the siblings of given tab and destroy them allactivateTab(tabId: string): voidcreateGroup(groupId?: string): void// new TabGroup({ id: groupId })updateTab(tabProps: {id: string, ...others}): void// update the tab with provide tabProps, id is required in tabPropsmoveTabToGroup(tabId: string,groupId: string): void// move tab to tabGroupinsertTabBefore(tabId: string,beforeTabId: string): void// insert tab (by id) before another tab (by id)}