Class: EditorService
molecule.EditorService
Hierarchy
Implements
Constructors
constructor
• new EditorService()
Overrides
Defined in
services/workbench/editorService.ts:226
Properties
defaultActions
• Protected
defaultActions: IEditorActionsProps
[] = []
Defined in
services/workbench/editorService.ts:221
defaultMenus
• Protected
defaultMenus: IMenuItemProps
[] = []
Defined in
services/workbench/editorService.ts:222
explorerService
• Protected
explorerService: IExplorerService
Defined in
services/workbench/editorService.ts:223
layoutService
• Protected
layoutService: ILayoutService
Defined in
services/workbench/editorService.ts:224
state
• Protected
state: IEditor
Implementation of
Overrides
Defined in
services/workbench/editorService.ts:220
Accessors
editorInstance
• get
editorInstance(): any
The instance of MonacoEditor
Returns
any
Implementation of
Defined in
services/workbench/editorService.ts:317
Methods
cloneGroup
▸ cloneGroup(groupId?
): IEditorGroup
<any
, any
>
Clone a specific group, if the argument groupId
is undefined,
there default clone the current group
Parameters
Name | Type |
---|---|
groupId? | UniqueId |
Returns
IEditorGroup
<any
, any
>
Implementation of
Defined in
services/workbench/editorService.ts:733
closeAll
▸ closeAll(groupId
): void
Close the specific group all opened tabs
Parameters
Name | Type |
---|---|
groupId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:692
closeOther
▸ closeOther(tab
, groupId
): void
Close other opened tabs in Editor Group
Parameters
Name | Type |
---|---|
tab | IEditorTab <BuiltInEditorTabDataType > |
groupId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:469
closeTab
▸ closeTab(tabId
, groupId
): void
Close the specific Tab opened in Editor Group view
Parameters
Name | Type |
---|---|
tabId | UniqueId |
groupId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:403
closeToLeft
▸ closeToLeft(tab
, groupId
): void
Close the left opened Tabs in Editor Group
Parameters
Name | Type |
---|---|
tab | IEditorTab <BuiltInEditorTabDataType > |
groupId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:533
closeToRight
▸ closeToRight(tab
, groupId
): void
Close the right opened tabs in Editor Group
Parameters
Name | Type |
---|---|
tab | IEditorTab <BuiltInEditorTabDataType > |
groupId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:501
count
▸ count(name
): number
Count the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
Returns
number
Implementation of
Inherited from
Defined in
disposeModel
▸ Private
disposeModel(tabs
): void
Parameters
Name | Type |
---|---|
tabs | IEditorTab <BuiltInEditorTabDataType > | IEditorTab <BuiltInEditorTabDataType >[] |
Returns
void
Defined in
services/workbench/editorService.ts:253
emit
▸ emit(name
, ...args
): void
Emit the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Implementation of
Inherited from
Defined in
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
Inherited from
Defined in
getDefaultActions
▸ getDefaultActions(): IEditorActionsProps
[]
Get the default group actions
Returns
Implementation of
IEditorService.getDefaultActions
Defined in
services/workbench/editorService.ts:245
getDefaultMenus
▸ getDefaultMenus(): IMenuItemProps
[]
Get the default group menus
Returns
Implementation of
IEditorService.getDefaultMenus
Defined in
services/workbench/editorService.ts:249
getGroupById
▸ getGroupById(groupId
): undefined
| IEditorGroup
<any
, any
>
Get the specific group
Parameters
Name | Type |
---|---|
groupId | UniqueId |
Returns
undefined
| IEditorGroup
<any
, any
>
Implementation of
Defined in
services/workbench/editorService.ts:565
getGroupIdByTab
▸ getGroupIdByTab(tabId
): null
| UniqueId
Get the group's id which contains the tab
Parameters
Name | Type |
---|---|
tabId | UniqueId |
Returns
null
| UniqueId
Implementation of
IEditorService.getGroupIdByTab
Defined in
services/workbench/editorService.ts:575
getGroupIndexById
▸ getGroupIndexById(id
): number
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
number
Defined in
services/workbench/editorService.ts:570
getState
▸ getState(): IEditor
Get the Component state
Returns
Implementation of
Inherited from
Defined in
getTabById
▸ getTabById<T
>(tabId
, groupId
): undefined
| IEditorTab
<T
>
Get a tab from a specific group via the tab ID
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
tabId | UniqueId |
groupId | UniqueId |
Returns
undefined
| IEditorTab
<T
>
Implementation of
Defined in
services/workbench/editorService.ts:306
isOpened
▸ isOpened(tabId
, filterGroups?
): boolean
Judge the specific tabs whether opened in Editor view
Parameters
Name | Type |
---|---|
tabId | UniqueId |
filterGroups? | IEditorGroup <any , any >[] |
Returns
boolean
Implementation of
Defined in
services/workbench/editorService.ts:260
onActionsClick
▸ onActionsClick(callback
): void
Listen to the Group Actions click event
Parameters
Name | Type |
---|---|
callback | (menuId : UniqueId , currentGroup : IEditorGroup <any , any >) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:800
onCloseAll
▸ onCloseAll(callback
): void
Listen to the all tabs close event
Parameters
Name | Type |
---|---|
callback | (groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:774
onCloseOther
▸ onCloseOther(callback
): void
Listen to the other tabs close event
Parameters
Name | Type |
---|---|
callback | (tabItem : IEditorTab <BuiltInEditorTabDataType >, groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:782
onCloseTab
▸ onCloseTab(callback
): void
Listen to the tab close event
Parameters
Name | Type |
---|---|
callback | (tabId : UniqueId , groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:778
onCloseToLeft
▸ onCloseToLeft(callback
): void
Listen to the left tabs close event
Parameters
Name | Type |
---|---|
callback | (tabItem : IEditorTab <BuiltInEditorTabDataType >, groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:788
onCloseToRight
▸ onCloseToRight(callback
): void
Listen to the right tabs close event
Parameters
Name | Type |
---|---|
callback | (tabItem : IEditorTab <BuiltInEditorTabDataType >, groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:794
onEditorInstanceMount
▸ onEditorInstanceMount(callback
): void
Listen to the editor instance mount event
Parameters
Name | Type |
---|---|
callback | (editorInstance : IStandaloneCodeEditor ) => void |
Returns
void
Implementation of
IEditorService.onEditorInstanceMount
Defined in
services/workbench/editorService.ts:806
onMoveTab
▸ onMoveTab(callback
): void
Listen to the tab move event
Parameters
Name | Type |
---|---|
callback | (updateTabs : IEditorTab <any >[], groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:762
onOpenTab
▸ onOpenTab(callback
): void
Listen to the tab opening event
Parameters
Name | Type |
---|---|
callback | (tab : IEditorTab <BuiltInEditorTabDataType >) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:688
onSelectTab
▸ onSelectTab(callback
): void
Listen to the tab select event
Parameters
Name | Type |
---|---|
callback | (tabId : UniqueId , groupId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:768
onUpdateState
▸ onUpdateState(listener
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
listener | (prevState : IEditor , nextState : IEditor ) => void |
Returns
void
Implementation of
Inherited from
Defined in
onUpdateTab
▸ onUpdateTab(callback
): void
Listen to the Editor tab changed event
Parameters
Name | Type |
---|---|
callback | (tab : IEditorTab <BuiltInEditorTabDataType >) => void |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:758
open
▸ open<T
>(tab
, groupId?
): void
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
tab | IEditorTab <T > | - |
groupId? | UniqueId | If provided, will open tab in specific group |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:642
removeOnUpdateState
▸ removeOnUpdateState(listener?
): void
Remove the Component update event listening, default is remove all, also you can remove one by pass the listener
Parameters
Name | Type |
---|---|
listener? | Function |
Returns
void
Implementation of
IEditorService.removeOnUpdateState
Inherited from
Defined in
render
▸ render(nextState?
): void
Initiative notify the component to render the view by the state
Parameters
Name | Type |
---|---|
nextState? | IEditor |
Returns
void
Implementation of
Inherited from
Defined in
setActive
▸ setActive(groupId
, tabId
): void
Set active group and tab
Parameters
Name | Type |
---|---|
groupId | UniqueId |
tabId | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:588
setDefaultActions
▸ setDefaultActions(actions
): void
Set default actions when create a new group
Parameters
Name | Type |
---|---|
actions | IEditorActionsProps [] |
Returns
void
Implementation of
IEditorService.setDefaultActions
Defined in
services/workbench/editorService.ts:268
setDefaultMenus
▸ setDefaultMenus(menus
): void
Set default menus when create a new group
Parameters
Name | Type |
---|---|
menus | IMenuItemProps [] |
Returns
void
Implementation of
IEditorService.setDefaultMenus
Defined in
services/workbench/editorService.ts:272
setEntry
▸ setEntry(component
): void
Specify the Entry page of Workbench
Parameters
Name | Type |
---|---|
component | ReactNode |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:276
setGroupEditorValue
▸ setGroupEditorValue(group
, value
): void
Updates the editor content for a specific group
Parameters
Name | Type |
---|---|
group | IEditorGroup <any , any > |
value | string |
Returns
void
Implementation of
IEditorService.setGroupEditorValue
Defined in
services/workbench/editorService.ts:393
setState
▸ setState(values
, callback?
): void
Set the state values, and notify the view component to re render
Parameters
Name | Type | Description |
---|---|---|
values | Partial <IEditor > | update target state values |
callback? | (prevState : IEditor , nextState : IEditor ) => void | - |
Returns
void
Implementation of
Inherited from
Defined in
subscribe
▸ subscribe(name
, listener
): void
Subscribe the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | string [] | Event name |
listener | Function | Listener function |
Returns
void
Implementation of
Inherited from
Defined in
unsubscribe
▸ unsubscribe(name
, listener?
): void
Unsubscribe the specific event and the listener function
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
listener? | Function | optional, it unsubscribes events via name if not pass the listener function |
Returns
void
Implementation of
Inherited from
Defined in
updateActions
▸ updateActions(actions
, groupId?
): void
Update actions in specific group
Parameters
Name | Type |
---|---|
actions | IMenuItemProps [] |
groupId? | UniqueId |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:282
updateCurrentGroup
▸ updateCurrentGroup(currentValues
): void
Update the current group
Parameters
Name | Type |
---|---|
currentValues | Partial <IEditorGroup <any , any >> |
Returns
void
Implementation of
IEditorService.updateCurrentGroup
Defined in
services/workbench/editorService.ts:633
updateEditorOptions
▸ updateEditorOptions(options
): void
Update the editor options
Parameters
Name | Type |
---|---|
options | IEditorOptions |
Returns
void
Implementation of
IEditorService.updateEditorOptions
Defined in
services/workbench/editorService.ts:233
updateGroup
▸ updateGroup(groupId
, groupValues
): void
Update the specific group
Parameters
Name | Type |
---|---|
groupId | UniqueId |
groupValues | Omit <IEditorGroup <any , any >, "id" > |
Returns
void
Implementation of
Defined in
services/workbench/editorService.ts:611
updateTab
▸ updateTab(tab
, groupId?
): IEditorTab
<BuiltInEditorTabDataType
>
Update the specific tab, if the groupId provide, then update the tab of specific group
Parameters
Name | Type |
---|---|
tab | IEditorTab <BuiltInEditorTabDataType > |
groupId? | UniqueId |
Returns
IEditorTab
<BuiltInEditorTabDataType
>