Home > LIB_PanelLibrary > openInEditor
LIB_PanelLibrary.openInEditor() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Open in the editor document
Signature
typescript
function openInEditor(
panelLibraryUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
panelLibraryUuid | string | Panel library UUID |
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
splitScreenId | string | (Optional) Split screen ID. If not filled in, it opens in the split screen with the last input focus by default. It can be obtained using the APIs in DMT_EditorControl |
Returns
Promise<string | undefined>
Tab ID, corresponding to IDMT_EditorTabItem.tabId. You can use DMT_EditorControl.getSplitScreenIdByTabId() to get the split screen ID
Example
javascript
// 1. 获取个人库 UUID 并新建面板库
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const panelLibraryUuid = await eda.lib_PanelLibrary.create(
libraryUuid,
`嘉立创示例_编辑面板库_${Date.now()}`,
[]
);
// 2. 在编辑器中打开该面板库,返回标签页 ID(uuid@libraryUuid 格式)
const tabId = await eda.lib_PanelLibrary.openInEditor(panelLibraryUuid, libraryUuid);
// 打开后保留现场(编辑器停留在新面板库页供观察;不需要时可传 tabId 给
// dmt_EditorControl.closeDocument 关闭)
console.log('panelLibraryUuid:', panelLibraryUuid);
console.log('tabId:', tabId);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16