Skip to main content
Version: 0.9.0-beta.2

Class: EditorService

molecule.EditorService

Hierarchy​

Implements​

Constructors​

constructor​

• new EditorService()

Overrides​

Component.constructor

Defined in​

src/services/workbench/editorService.ts:211

Properties​

defaultActions​

• Protected defaultActions: IEditorActionsProps[] = []

Defined in​

src/services/workbench/editorService.ts:207


defaultMenus​

• Protected defaultMenus: IMenuItemProps[] = []

Defined in​

src/services/workbench/editorService.ts:208


explorerService​

• Protected explorerService: IExplorerService

Defined in​

src/services/workbench/editorService.ts:209


state​

• Protected state: IEditor

Implementation of​

IEditorService.state

Overrides​

Component.state

Defined in​

src/services/workbench/editorService.ts:206

Accessors​

editorInstance​

• get editorInstance(): any

The instance of MonacoEditor

Returns​

any

Implementation of​

IEditorService.editorInstance

Defined in​

src/services/workbench/editorService.ts:301

Methods​

cloneGroup​

▸ cloneGroup(groupId?): IEditorGroup<any, any>

Clone a specific group, if the argument groupId is undefined, there default clone the current group

Parameters​

NameType
groupId?UniqueId

Returns​

IEditorGroup<any, any>

Implementation of​

IEditorService.cloneGroup

Defined in​

src/services/workbench/editorService.ts:668


closeAll​

▸ closeAll(groupId): void

Close the specific group all opened tabs

Parameters​

NameType
groupIdUniqueId

Returns​

void

Implementation of​

IEditorService.closeAll

Defined in​

src/services/workbench/editorService.ts:633


closeOther​

▸ closeOther(tab, groupId): void

Close other opened tabs in Editor Group

Parameters​

NameType
tabIEditorTab<BuiltInEditorTabDataType>
groupIdUniqueId

Returns​

void

Implementation of​

IEditorService.closeOther

Defined in​

src/services/workbench/editorService.ts:410


closeTab​

▸ closeTab(tabId, groupId): void

Close the specific Tab opened in Editor Group view

Parameters​

NameType
tabIdUniqueId
groupIdUniqueId

Returns​

void

Implementation of​

IEditorService.closeTab

Defined in​

src/services/workbench/editorService.ts:351


closeToLeft​

▸ closeToLeft(tab, groupId): void

Close the left opened Tabs in Editor Group

Parameters​

NameType
tabIEditorTab<BuiltInEditorTabDataType>
groupIdUniqueId

Returns​

void

Implementation of​

IEditorService.closeToLeft

Defined in​

src/services/workbench/editorService.ts:474


closeToRight​

▸ closeToRight(tab, groupId): void

Close the right opened tabs in Editor Group

Parameters​

NameType
tabIEditorTab<BuiltInEditorTabDataType>
groupIdUniqueId

Returns​

void

Implementation of​

IEditorService.closeToRight

Defined in​

src/services/workbench/editorService.ts:442


count​

▸ count(name): number

Count the service event

Parameters​

NameTypeDescription
namestringEvent name

Returns​

number

Implementation of​

IEditorService.count

Inherited from​

Component.count

Defined in​

src/common/event/eventBus.ts:28


disposeModel​

▸ Private disposeModel(tabs): void

Parameters​

NameType
tabsIEditorTab<BuiltInEditorTabDataType> | IEditorTab<BuiltInEditorTabDataType>[]

Returns​

void

Defined in​

src/services/workbench/editorService.ts:237


emit​

▸ emit(name, ...args): void

Emit the service event

Parameters​

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns​

void

Implementation of​

IEditorService.emit

Inherited from​

Component.emit

Defined in​

src/common/event/eventBus.ts:20


forceUpdate​

▸ forceUpdate(): void

Force to update the Component

Returns​

void

Implementation of​

IEditorService.forceUpdate

Inherited from​

Component.forceUpdate

Defined in​

src/react/component.ts:79


getDefaultActions​

▸ getDefaultActions(): IEditorActionsProps[]

Get the default group actions

Returns​

IEditorActionsProps[]

Implementation of​

IEditorService.getDefaultActions

Defined in​

src/services/workbench/editorService.ts:229


getDefaultMenus​

▸ getDefaultMenus(): IMenuItemProps[]

Get the default group menus

Returns​

IMenuItemProps[]

Implementation of​

IEditorService.getDefaultMenus

Defined in​

src/services/workbench/editorService.ts:233


getGroupById​

▸ getGroupById(groupId): undefined | IEditorGroup<any, any>

Get the specific group

Parameters​

NameType
groupIdUniqueId

Returns​

undefined | IEditorGroup<any, any>

Implementation of​

IEditorService.getGroupById

Defined in​

src/services/workbench/editorService.ts:506


getGroupIdByTab​

▸ getGroupIdByTab(tabId): null | UniqueId

Get the group's id which contains the tab

Parameters​

NameType
tabIdUniqueId

Returns​

null | UniqueId

Implementation of​

IEditorService.getGroupIdByTab

Defined in​

src/services/workbench/editorService.ts:516


getGroupIndexById​

▸ getGroupIndexById(id): number

Parameters​

NameType
idUniqueId

Returns​

number

Defined in​

src/services/workbench/editorService.ts:511


getState​

▸ getState(): IEditor

Get the Component state

Returns​

IEditor

Implementation of​

IEditorService.getState

Inherited from​

Component.getState

Defined in​

src/react/component.ts:83


getTabById​

▸ getTabById<T>(tabId, groupId): undefined | IEditorTab<T>

Get a tab from a specific group via the tab ID

Type parameters​

Name
T

Parameters​

NameType
tabIdUniqueId
groupIdUniqueId

Returns​

undefined | IEditorTab<T>

Implementation of​

IEditorService.getTabById

Defined in​

src/services/workbench/editorService.ts:290


isOpened​

▸ isOpened(tabId, filterGroups?): boolean

Judge the specific tabs whether opened in Editor view

Parameters​

NameType
tabIdUniqueId
filterGroups?IEditorGroup<any, any>[]

Returns​

boolean

Implementation of​

IEditorService.isOpened

Defined in​

src/services/workbench/editorService.ts:244


onActionsClick​

▸ onActionsClick(callback): void

Listen to the Group Actions click event

Parameters​

NameType
callback(menuId: UniqueId, currentGroup: IEditorGroup<any, any>) => void

Returns​

void

Implementation of​

IEditorService.onActionsClick

Defined in​

src/services/workbench/editorService.ts:735


onCloseAll​

▸ onCloseAll(callback): void

Listen to the all tabs close event

Parameters​

NameType
callback(groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onCloseAll

Defined in​

src/services/workbench/editorService.ts:709


onCloseOther​

▸ onCloseOther(callback): void

Listen to the other tabs close event

Parameters​

NameType
callback(tabItem: IEditorTab<BuiltInEditorTabDataType>, groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onCloseOther

Defined in​

src/services/workbench/editorService.ts:717


onCloseTab​

▸ onCloseTab(callback): void

Listen to the tab close event

Parameters​

NameType
callback(tabId: UniqueId, groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onCloseTab

Defined in​

src/services/workbench/editorService.ts:713


onCloseToLeft​

▸ onCloseToLeft(callback): void

Listen to the left tabs close event

Parameters​

NameType
callback(tabItem: IEditorTab<BuiltInEditorTabDataType>, groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onCloseToLeft

Defined in​

src/services/workbench/editorService.ts:723


onCloseToRight​

▸ onCloseToRight(callback): void

Listen to the right tabs close event

Parameters​

NameType
callback(tabItem: IEditorTab<BuiltInEditorTabDataType>, groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onCloseToRight

Defined in​

src/services/workbench/editorService.ts:729


onMoveTab​

▸ onMoveTab(callback): void

Listen to the tab move event

Parameters​

NameType
callback(updateTabs: IEditorTab<any>[], groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onMoveTab

Defined in​

src/services/workbench/editorService.ts:697


onOpenTab​

▸ onOpenTab(callback): void

Listen to the tab opening event

Parameters​

NameType
callback(tab: IEditorTab<BuiltInEditorTabDataType>) => void

Returns​

void

Implementation of​

IEditorService.onOpenTab

Defined in​

src/services/workbench/editorService.ts:629


onSelectTab​

▸ onSelectTab(callback): void

Listen to the tab select event

Parameters​

NameType
callback(tabId: UniqueId, groupId?: UniqueId) => void

Returns​

void

Implementation of​

IEditorService.onSelectTab

Defined in​

src/services/workbench/editorService.ts:703


onUpdateState​

▸ onUpdateState(callback): void

Listen to the Component state update event

Parameters​

NameType
callback(prevState: IEditor, nextState: IEditor) => void

Returns​

void

Implementation of​

IEditorService.onUpdateState

Inherited from​

Component.onUpdateState

Defined in​

src/react/component.ts:71


onUpdateTab​

▸ onUpdateTab(callback): void

Listen to the Editor tab changed event

Parameters​

NameType
callback(tab: IEditorTab<BuiltInEditorTabDataType>) => void

Returns​

void

Implementation of​

IEditorService.onUpdateTab

Defined in​

src/services/workbench/editorService.ts:693


open​

▸ open<T>(tab, groupId?): void

Type parameters​

Name
T

Parameters​

NameTypeDescription
tabIEditorTab<T>-
groupId?UniqueIdIf provided, will open tab in specific group

Returns​

void

Implementation of​

IEditorService.open

Defined in​

src/services/workbench/editorService.ts:583


removeOnUpdateState​

▸ removeOnUpdateState(): void

Remove the Component update event listening

Returns​

void

Implementation of​

IEditorService.removeOnUpdateState

Inherited from​

Component.removeOnUpdateState

Defined in​

src/react/component.ts:75


render​

▸ render(nextState?): void

Initiative notify the component to render the view by the state

Parameters​

NameType
nextState?IEditor

Returns​

void

Implementation of​

IEditorService.render

Inherited from​

Component.render

Defined in​

src/react/component.ts:67


setActive​

▸ setActive(groupId, tabId): void

Set active group and tab

Parameters​

NameType
groupIdUniqueId
tabIdUniqueId

Returns​

void

Implementation of​

IEditorService.setActive

Defined in​

src/services/workbench/editorService.ts:529


setDefaultActions​

▸ setDefaultActions(actions): void

Set default actions when create a new group

Parameters​

NameType
actionsIEditorActionsProps[]

Returns​

void

Implementation of​

IEditorService.setDefaultActions

Defined in​

src/services/workbench/editorService.ts:252


setDefaultMenus​

▸ setDefaultMenus(menus): void

Set default menus when create a new group

Parameters​

NameType
menusIMenuItemProps[]

Returns​

void

Implementation of​

IEditorService.setDefaultMenus

Defined in​

src/services/workbench/editorService.ts:256


setEntry​

▸ setEntry(component): void

Specify the Entry page of Workbench

Parameters​

NameType
componentReactNode

Returns​

void

Implementation of​

IEditorService.setEntry

Defined in​

src/services/workbench/editorService.ts:260


setState​

▸ setState(values, callback?): void

Set the state values, and notify the view component to re render

Parameters​

NameTypeDescription
valuesPartial<IEditor>update target state values
callback?(prevState: IEditor, nextState: IEditor) => void-

Returns​

void

Implementation of​

IEditorService.setState

Inherited from​

Component.setState

Defined in​

src/react/component.ts:54


subscribe​

▸ subscribe(name, callback): void

Subscribe the service event

Parameters​

NameTypeDescription
namestring | string[]Event name
callbackFunctionCallback function

Returns​

void

Implementation of​

IEditorService.subscribe

Inherited from​

Component.subscribe

Defined in​

src/common/event/eventBus.ts:11


unsubscribe​

▸ unsubscribe(name): void

Unsubscribe the specific event

Parameters​

NameTypeDescription
nameanyThe event name

Returns​

void

Implementation of​

IEditorService.unsubscribe

Inherited from​

Component.unsubscribe

Defined in​

src/common/event/eventBus.ts:37


updateActions​

▸ updateActions(actions, groupId?): void

Update actions in specific group

Parameters​

NameType
actionsIMenuItemProps[]
groupId?UniqueId

Returns​

void

Implementation of​

IEditorService.updateActions

Defined in​

src/services/workbench/editorService.ts:266


updateCurrentGroup​

▸ updateCurrentGroup(currentValues): void

Update the current group

Parameters​

NameType
currentValuesPartial<IEditorGroup<any, any>>

Returns​

void

Implementation of​

IEditorService.updateCurrentGroup

Defined in​

src/services/workbench/editorService.ts:574


updateEditorOptions​

▸ updateEditorOptions(options): void

Update the editor options

Parameters​

NameType
optionsIEditorOptions

Returns​

void

Implementation of​

IEditorService.updateEditorOptions

Defined in​

src/services/workbench/editorService.ts:217


updateGroup​

▸ updateGroup(groupId, groupValues): void

Update the specific group

Parameters​

NameType
groupIdUniqueId
groupValuesOmit<IEditorGroup<any, any>, "id">

Returns​

void

Implementation of​

IEditorService.updateGroup

Defined in​

src/services/workbench/editorService.ts:552


updateTab​

▸ updateTab(tab, groupId?): IEditorTab<BuiltInEditorTabDataType>

Update the specific tab, if the groupId provide, then update the tab of specific group

Parameters​

NameType
tabIEditorTab<BuiltInEditorTabDataType>
groupId?UniqueId

Returns​

IEditorTab<BuiltInEditorTabDataType>

Implementation of​

IEditorService.updateTab

Defined in​

src/services/workbench/editorService.ts:305