English
Home > PCB_RightClickMenu > replaceMenu
PCB_RightClickMenu.replaceMenu() 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.
完全覆盖右键菜单
Signature
typescript
function replaceMenu(
target: EPCB_RightClickMenuTarget,
menuItems: Array<ISYS_RightClickMenuItem | null>,
): Promise<boolean>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
target | 目标右键菜单位置 | |
menuItems | Array<ISYS_RightClickMenuItem | null> | 替换后的完整菜单项列表, |
Returns
Promise<boolean>
是否覆盖成功
Remarks
用传入的菜单项列表整体替换指定位置的右键菜单,原有菜单项全部丢弃
若希望保留某个内置菜单项,在列表中传入只带 id 的菜单项即可,其原始标题、图标、快捷键与动作会保持不变
数组中的 null 代表一条分隔符
本接口需要使用者启用扩展的外部交互权限,如若未启用将始终 throw Error ADD since EDA v5