跳到主要内容
版本:1.x

Interface: IEditorService

molecule.IEditorService

Hierarchy​

Implemented by​

Properties​

editorInstance​

• Readonly editorInstance: IStandaloneCodeEditor

The instance of MonacoEditor

Defined in​

services/workbench/editorService.ts:202


state​

• Protected Abstract state: IEditor

Inherited from​

Component.state

Defined in​

react/component.ts:44

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>

Defined in​

services/workbench/editorService.ts:98


closeAll​

▸ closeAll(groupId): void

Close the specific group all opened tabs

Parameters​

NameTypeDescription
groupIdUniqueIdThe groupId is required

Returns​

void

Defined in​

services/workbench/editorService.ts:87


closeOther​

▸ closeOther(tab, groupId): void

Close other opened tabs in Editor Group

Parameters​

NameTypeDescription
tabIEditorTab<BuiltInEditorTabDataType>The id is required
groupIdUniqueIdThe groupId is required

Returns​

void

Defined in​

services/workbench/editorService.ts:70


closeTab​

▸ closeTab(tabId, groupId): void

Close the specific Tab opened in Editor Group view

Parameters​

NameTypeDescription
tabIdUniqueIdThe tabId is required
groupIdUniqueIdThe groupId is required

Returns​

void

Defined in​

services/workbench/editorService.ts:64


closeToLeft​

▸ closeToLeft(tab, groupId): void

Close the left opened Tabs in Editor Group

Parameters​

NameTypeDescription
tabIEditorTab<BuiltInEditorTabDataType>The id is required, the start point of close to left
groupIdUniqueIdThe groupId is required

Returns​

void

Defined in​

services/workbench/editorService.ts:82


closeToRight​

▸ closeToRight(tab, groupId): void

Close the right opened tabs in Editor Group

Parameters​

NameTypeDescription
tabIEditorTab<BuiltInEditorTabDataType>The id is required, the start point of close to right
groupIdUniqueIdThe groupId is required

Returns​

void

Defined in​

services/workbench/editorService.ts:76


count​

▸ count(name): number

Count the service event

Parameters​

NameTypeDescription
namestringEvent name

Returns​

number

Inherited from​

Component.count

Defined in​

common/event/eventBus.ts:28


emit​

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

Emit the service event

Parameters​

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns​

void

Inherited from​

Component.emit

Defined in​

common/event/eventBus.ts:20


forceUpdate​

▸ forceUpdate(): void

Force to update the Component

Returns​

void

Inherited from​

Component.forceUpdate

Defined in​

react/component.ts:81


getDefaultActions​

▸ getDefaultActions(): IEditorActionsProps[]

Get the default group actions

Returns​

IEditorActionsProps[]

Defined in​

services/workbench/editorService.ts:189


getDefaultMenus​

▸ getDefaultMenus(): IMenuItemProps[]

Get the default group menus

Returns​

IMenuItemProps[]

Defined in​

services/workbench/editorService.ts:193


getGroupById​

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

Get the specific group

Parameters​

NameTypeDescription
groupIdUniqueIdThe groupId is required

Returns​

undefined | IEditorGroup<any, any>

Defined in​

services/workbench/editorService.ts:92


getGroupIdByTab​

▸ getGroupIdByTab(tabId): null | UniqueId

Get the group's id which contains the tab

Parameters​

NameType
tabIdUniqueId

Returns​

null | UniqueId

Defined in​

services/workbench/editorService.ts:207


getState​

▸ getState(): IEditor

Get the Component state

Returns​

IEditor

Inherited from​

Component.getState

Defined in​

react/component.ts:85


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>

Defined in​

services/workbench/editorService.ts:34


isOpened​

▸ isOpened(tabId): boolean

Judge the specific tabs whether opened in Editor view

Parameters​

NameTypeDescription
tabIdUniqueIdThe tabId is required

Returns​

boolean

Defined in​

services/workbench/editorService.ts:58


onActionsClick​

▸ onActionsClick(callback): void

Listen to the Group Actions click event

Parameters​

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

Returns​

void

Defined in​

services/workbench/editorService.ts:150


onCloseAll​

▸ onCloseAll(callback): any

Listen to the all tabs close event

Parameters​

NameType
callback(groupId?: UniqueId) => void

Returns​

any

Defined in​

services/workbench/editorService.ts:125


onCloseOther​

▸ onCloseOther(callback): any

Listen to the other tabs close event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:135


onCloseTab​

▸ onCloseTab(callback): any

Listen to the tab close event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:130


onCloseToLeft​

▸ onCloseToLeft(callback): any

Listen to the left tabs close event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:140


onCloseToRight​

▸ onCloseToRight(callback): any

Listen to the right tabs close event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:145


onMoveTab​

▸ onMoveTab(callback): any

Listen to the tab move event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:113


onOpenTab​

▸ onOpenTab(callback): void

Listen to the tab opening event

Parameters​

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

Returns​

void

Defined in​

services/workbench/editorService.ts:108


onSelectTab​

▸ onSelectTab(callback): any

Listen to the tab select event

Parameters​

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

Returns​

any

Defined in​

services/workbench/editorService.ts:120


onUpdateState​

▸ onUpdateState(listener): void

Listen to the Component state update event

Parameters​

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

Returns​

void

Inherited from​

Component.onUpdateState

Defined in​

react/component.ts:73


onUpdateTab​

▸ onUpdateTab(callback): void

Listen to the Editor tab changed event

Parameters​

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

Returns​

void

Defined in​

services/workbench/editorService.ts:103


open​

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

Open a new tab in a specific group

Type parameters​

NameType
Tany

Parameters​

NameTypeDescription
tabIEditorTab<T>Tab data
groupId?UniqueIdGroup ID

Returns​

void

Defined in​

services/workbench/editorService.ts:28


removeOnUpdateState​

▸ removeOnUpdateState(listener?): void

Remove the Component update event listening, default is remove all, also you can remove one by pass the listener

Parameters​

NameType
listener?Function

Returns​

void

Inherited from​

Component.removeOnUpdateState

Defined in​

react/component.ts:77


render​

▸ render(nextState?): void

Initiative notify the component to render the view by the state

Parameters​

NameType
nextState?IEditor

Returns​

void

Inherited from​

Component.render

Defined in​

react/component.ts:69


setActive​

▸ setActive(groupId, tabId): any

Set active group and tab

Parameters​

NameTypeDescription
groupIdUniqueIdTarget group ID
tabIdUniqueIdTarget tab ID

Returns​

any

Defined in​

services/workbench/editorService.ts:158


setDefaultActions​

▸ setDefaultActions(actions): void

Set default actions when create a new group

Parameters​

NameType
actionsIEditorActionsProps[]

Returns​

void

Defined in​

services/workbench/editorService.ts:169


setDefaultMenus​

▸ setDefaultMenus(menus): void

Set default menus when create a new group

Parameters​

NameType
menusIMenuItemProps[]

Returns​

void

Defined in​

services/workbench/editorService.ts:174


setEntry​

▸ setEntry(component): void

Specify the Entry page of Workbench

Parameters​

NameType
componentElement

Returns​

void

Defined in​

services/workbench/editorService.ts:53


setGroupEditorValue​

▸ setGroupEditorValue(group, value): void

Updates the editor content for a specific group

Parameters​

NameTypeDescription
groupIEditorGroup<any, any>The editorInstance is required
valuestring

Returns​

void

Defined in​

services/workbench/editorService.ts:49


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

Inherited from​

Component.setState

Defined in​

react/component.ts:56


subscribe​

▸ subscribe(name, listener): void

Subscribe the service event

Parameters​

NameTypeDescription
namestring | string[]Event name
listenerFunctionListener function

Returns​

void

Inherited from​

Component.subscribe

Defined in​

common/event/eventBus.ts:11


unsubscribe​

▸ unsubscribe(name, listener?): void

Unsubscribe the specific event and the listener function

Parameters​

NameTypeDescription
nameanyThe event name
listener?Functionoptional, it unsubscribes events via name if not pass the listener function

Returns​

void

Inherited from​

Component.unsubscribe

Defined in​

common/event/eventBus.ts:37


updateActions​

▸ updateActions(actions, groupId?): void

Update actions in specific group

Parameters​

NameType
actionsIMenuItemProps[]
groupId?UniqueId

Returns​

void

Defined in​

services/workbench/editorService.ts:180


updateCurrentGroup​

▸ updateCurrentGroup(currentValues): void

Update the current group

Parameters​

NameType
currentValuesany

Returns​

void

Defined in​

services/workbench/editorService.ts:185


updateEditorOptions​

▸ updateEditorOptions(options): void

Update the editor options

Parameters​

NameType
optionsIEditorOptions

Returns​

void

Defined in​

services/workbench/editorService.ts:198


updateGroup​

▸ updateGroup(groupId, groupValues): void

Update the specific group

Parameters​

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

Returns​

void

Defined in​

services/workbench/editorService.ts:164


updateTab​

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

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

Parameters​

NameTypeDescription
tabIEditorTab<BuiltInEditorTabDataType>The id is required
groupId?UniqueId

Returns​

IEditorTab<BuiltInEditorTabDataType>

Defined in​

services/workbench/editorService.ts:43