new TabManager()
Tab Manager - Handles all tab operations including creation, switching, and closing.
This manager provides a complete tab interface similar to modern code editors, allowing users to work with multiple files simultaneously. It manages tab state, coordinates with the editor manager, and handles file modifications tracking.
- Version:
- 1.0.0
- Source:
Example
const tabManager = new TabManager(editorManager, notificationManager);
const tabId = tabManager.createTab('example.js', '/path/to/example.js', 'console.log("Hello")');
Classes
Members
activeTabId :string|null
Currently active tab ID
Type:
- string | null
- Source:
Methods
closeTab(event, tabId)
Close a tab
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event | Click event |
tabId |
string | Tab ID to close |
- Source:
createNewFile() → {string}
Create a new untitled file tab
- Source:
Returns:
- New tab ID
- Type
- string
createTab(fileName, filePath, content, fileInfo) → {string}
Create a new tab
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
fileName |
string | Tab file name |
|
filePath |
string | null | File path (optional) |
content |
string | File content |
|
fileInfo |
Object | File metadata |
- Source:
Returns:
- Tab ID
- Type
- string
findTabByPath(filePath) → {string|null}
Check if file is already open in a tab
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | File path to check |
- Source:
Returns:
- Tab ID if found, null otherwise
- Type
- string | null
getActiveTab() → {Object|null}
Get current active tab
- Source:
Returns:
- Active tab data or null
- Type
- Object | null
getTabCount() → {number}
Get all open tabs count
- Source:
Returns:
- Number of open tabs
- Type
- number
handleContentChange(tabId, newContent)
Handle tab content changes (for modification tracking)
Parameters:
| Name | Type | Description |
|---|---|---|
tabId |
string | Tab ID |
newContent |
string | New content |
- Source:
markTabClean(tabId)
Mark tab as clean (not modified)
Parameters:
| Name | Type | Description |
|---|---|---|
tabId |
string | Tab ID |
- Source:
markTabModified(tabId)
Mark tab as modified
Parameters:
| Name | Type | Description |
|---|---|---|
tabId |
string | Tab ID |
- Source:
onLoadFullFile(filePath)
Callback for loading full file (to be implemented by parent)
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | File path to load |
- Source:
onTabSwitch(tabData)
Callback for when tab switches (for other components to listen to)
Parameters:
| Name | Type | Description |
|---|---|---|
tabData |
Object | Tab data |
- Source:
showEditor()
Show editor
- Source:
showWelcomeScreen()
Show welcome screen
- Source:
switchToNextTab()
Switch to next tab
- Source:
switchToTab(tabId)
Switch to a specific tab
Parameters:
| Name | Type | Description |
|---|---|---|
tabId |
string | Tab ID to switch to |
- Source:
updateFileStatus(tabData)
Update file status indicator
Parameters:
| Name | Type | Description |
|---|---|---|
tabData |
Object | Tab data |
- Source:
updateTabFile(tabId, filePath, fileName)
Update tab file info (for file operations)
Parameters:
| Name | Type | Description |
|---|---|---|
tabId |
string | Tab ID |
filePath |
string | New file path |
fileName |
string | New file name |
- Source: