Home > LIB_Symbol > openInEditor
LIB_Symbol.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(
symbolUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
symbolUuid | string | Symbol 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 [source] = await eda.lib_Symbol.search('', undefined, [], undefined, 1, 1);
const symbolUuid = await eda.lib_Symbol.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
[],
`嘉立创示例_编辑符号_${Date.now()}`
);
// 2. 在编辑器中打开该符号,返回标签页 ID(uuid@libraryUuid 格式)
const tabId = await eda.lib_Symbol.openInEditor(symbolUuid, libraryUuid);
// 打开后保留现场(编辑器停留在新符号页供观察;不需要时可传 tabId 给
// dmt_EditorControl.closeDocument 关闭)
console.log('symbolUuid:', symbolUuid);
console.log('tabId:', tabId);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19