WorkspaceManager
Import :
const WorkspaceManager = brackets.getModule("view/WorkspaceManager")
view/WorkspaceManager
Manages layout of panels surrounding the editor area, and size of the editor area (but not its contents).
Updates panel sizes when the window is resized. Maintains the max resizing limits for panels, based on currently available window size.
Events:
workspaceUpdateLayout When workspace size changes for any reason (including panel show/hide panel resize, or the window resize).
The 2nd arg is the available workspace height.
The 3rd arg is a refreshHint flag for internal use (passed in to recomputeLayout)
- view/WorkspaceManager
- static
- .PANEL_TYPE_BOTTOM_PANEL :
string - .PANEL_TYPE_PLUGIN_PANEL :
string
- .PANEL_TYPE_BOTTOM_PANEL :
- inner
- .$bottomPanelContainer :
jQueryObject - .$statusBarPanelToggle :
jQueryObject - ._statusBarToggleInProgress :
boolean - .EVENT_WORKSPACE_UPDATE_LAYOUT
- .EVENT_WORKSPACE_PANEL_SHOWN
- .EVENT_WORKSPACE_PANEL_HIDDEN
- .createBottomPanel(id, $panel, [minSize], [title]) ⇒
Panel - .destroyBottomPanel(id)
- .createPluginPanel(id, $panel, [minSize], $toolbarIcon, [initialSize]) ⇒
Panel - .getAllPanelIDs() ⇒
Array - .getPanelForID(panelID) ⇒
Object - .recomputeLayout(refreshHint)
- .isPanelVisible(panelID) ⇒
boolean - .setPluginPanelWidth(width)
- .addEscapeKeyEventHandler(consumerName, eventHandler) ⇒
boolean - .removeEscapeKeyEventHandler(consumerName) ⇒
boolean
- .$bottomPanelContainer :
- static
view/WorkspaceManager.PANEL_TYPE_BOTTOM_PANEL : string
Constant representing the type of bottom panel
Kind: static property of view/WorkspaceManager
view/WorkspaceManager.PANEL_TYPE_PLUGIN_PANEL : string
Constant representing the type of plugin panel
Kind: static property of view/WorkspaceManager
view/WorkspaceManager.$bottomPanelContainer : jQueryObject
The single container wrapping all bottom panels
Kind: inner property of view/WorkspaceManager
view/WorkspaceManager.$statusBarPanelToggle : jQueryObject
Chevron toggle in the status bar
Kind: inner property of view/WorkspaceManager
view/WorkspaceManager._statusBarToggleInProgress : boolean
True while the status bar toggle button is handling a click
Kind: inner property of view/WorkspaceManager
view/WorkspaceManager.EVENT_WORKSPACE_UPDATE_LAYOUT
Event triggered when the workspace layout updates.
Kind: inner constant of view/WorkspaceManager
view/WorkspaceManager.EVENT_WORKSPACE_PANEL_SHOWN
Event triggered when a panel is shown.
Kind: inner constant of view/WorkspaceManager
view/WorkspaceManager.EVENT_WORKSPACE_PANEL_HIDDEN
Event triggered when a panel is hidden.
Kind: inner constant of view/WorkspaceManager
view/WorkspaceManager.createBottomPanel(id, $panel, [minSize], [title]) ⇒ Panel
Creates a new resizable panel beneath the editor area and above the status bar footer. Panel is initially invisible. The panel's size & visibility are automatically saved & restored as a view-state preference.
Kind: inner method of view/WorkspaceManager
| Param | Type | Description |
|---|---|---|
| id | string | Unique id for this panel. Use package-style naming, e.g. "myextension.feature.panelname" |
| $panel | jQueryObject | DOM content to use as the panel. Need not be in the document yet. Must have an id attribute, for use as a preferences key. |
| [minSize] | number | @deprecated No longer used. Pass undefined. |
| [title] | string | Display title shown in the bottom panel tab bar. |
view/WorkspaceManager.destroyBottomPanel(id)
Destroys a bottom panel, removing it from internal registries, the tab bar, and the DOM. After calling this, the panel ID is no longer valid and the Panel instance should not be reused.
Kind: inner method of view/WorkspaceManager
| Param | Type | Description |
|---|---|---|
| id | string | The panel ID that was passed to createBottomPanel. |
view/WorkspaceManager.createPluginPanel(id, $panel, [minSize], $toolbarIcon, [initialSize]) ⇒ Panel
Creates a new resizable plugin panel associated with the given toolbar icon. Panel is initially invisible. The panel's size & visibility are automatically saved & restored. Only one panel can be associated with a toolbar icon.
Kind: inner method of view/WorkspaceManager
| Param | Type | Description |
|---|---|---|
| id | string | Unique id for this panel. Use package-style naming, e.g. "myextension.panelname". will overwrite an existing panel id if present. |
| $panel | jQueryObject | DOM content to use as the panel. Need not be in the document yet. Must have an id attribute, for use as a preferences key. |
| [minSize] | number | Minimum height of panel in px. |
| $toolbarIcon | jQueryObject | An icon that should be present in main-toolbar to associate this panel to. The panel will be shown only if the icon is visible on the toolbar and the user clicks on the icon. |
| [initialSize] | number | Optional Initial size of panel in px. If not given, panel will use minsize or current size. |
view/WorkspaceManager.getAllPanelIDs() ⇒ Array
Returns an array of all panel ID's
Kind: inner method of view/WorkspaceManager
Returns: Array - List of ID's of all bottom panels
view/WorkspaceManager.getPanelForID(panelID) ⇒ Object
Gets the Panel interface for the given ID. Can return undefined if no panel with the ID is found.
Kind: inner method of view/WorkspaceManager
Returns: Object - Panel object for the ID or undefined
| Param | Type |
|---|---|
| panelID | string |
view/WorkspaceManager.recomputeLayout(refreshHint)
Called when an external widget has appeared and needs some of the space occupied by the mainview manager
Kind: inner method of view/WorkspaceManager
| Param | Type | Description |
|---|---|---|
| refreshHint | boolean | true to refresh the editor, false if not |
view/WorkspaceManager.isPanelVisible(panelID) ⇒ boolean
Responsible to check if the panel is visible or not. Returns true if visible else false.
Kind: inner method of view/WorkspaceManager
| Param |
|---|
| panelID |
view/WorkspaceManager.setPluginPanelWidth(width)
Programmatically sets the plugin panel content width to the given value in pixels. The total toolbar width is adjusted to account for the plugin icons bar. Width is clamped to respect panel minWidth and max size (75% of window). No-op if no panel is currently visible.
Kind: inner method of view/WorkspaceManager
| Param | Type | Description |
|---|---|---|
| width | number | Desired content width in pixels |
view/WorkspaceManager.addEscapeKeyEventHandler(consumerName, eventHandler) ⇒ boolean
If any widgets related to the editor needs to handle the escape key event, add it here. returning true from the registered handler will prevent primary escape key toggle panel behavior of phoenix. Note that returning true will no stop the event bubbling, that has to be controlled with the event parameter forwarded to the handler.
Kind: inner method of view/WorkspaceManager
Returns: boolean - true if added
| Param | Type | Description |
|---|---|---|
| consumerName | string | a unique name for your consumer |
| eventHandler | function | If the eventHandler returns true for this callback, the escape key event will not lead to panel toggle default behavior. |
view/WorkspaceManager.removeEscapeKeyEventHandler(consumerName) ⇒ boolean
Removing the escape key event consumer.
Kind: inner method of view/WorkspaceManager
Returns: boolean - true if removed
| Param | Type | Description |
|---|---|---|
| consumerName | string | used to register the consumer. |