Home > SYS_HeaderMenu > removeSystemHeaderMenuItem
SYS_HeaderMenu.removeSystemHeaderMenuItem() 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.
Remove a system header menu item
Signature
function removeSystemHeaderMenuItem(
id: Array<string>,
props?: {
removeTheBeforeDivider?: undefined | false | true;
removeTheAfterDivider?: undefined | false | true;
},
): Promise<boolean>;2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
id | Array<string> | Menu item ID tree. It will match menu items by hierarchy in array order and remove the menu item corresponding to the last element; when only one element is passed, the corresponding first-level menu is removed |
props | { removeTheBeforeDivider?: undefined | false | true; removeTheAfterDivider?: undefined | false | true } | (Optional) Other parameters. Whether to remove the separators before and after the menu item (only takes effect when removing a sub-menu item) |
Returns
Promise<boolean>
Whether the removal operation was successful. If the menu is removed but the separator is not found, true is also returned
Remarks
Once a menu is removed, restarting the EasyEDA software is required to restore it
This API cannot remove the system header menu items imported by the API
When the id array contains only one element, the corresponding first-level menu is removed; when it contains multiple elements, the menu items are matched by hierarchy in array order, and the sub-menu item corresponding to the last element is removed
This API cannot remove the **Advanced** menu itself or any sub-menu under it
Note 1: This API requires the user to enable the extension external interaction permission, if not enabled, it will always throw Error
Note 2: The **remove first-level menu** function of this API is exclusive to the private deployment edition. Calling it in other editions will always throw Error
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.
Example
// 1. 先插入一个待移除的子菜单项(id 树:[一级菜单 ID, 新项 ID])
const menuId = await eda.sys_HeaderMenu.insertSystemHeaderMenuItem('pcb', ['Tools', '嘉立创示例_待移除项'], {
title: '嘉立创示例 待移除项',
});
console.log('待移除的菜单 ID:', menuId);
// 2. 移除该菜单项(id 树:[一级菜单 ID, insert 返回的重写 ID])
const removed = await eda.sys_HeaderMenu.removeSystemHeaderMenuItem(['Tools', menuId]);
console.log('移除结果:', removed);2
3
4
5
6
7
8
9