feat: add table context to contextmenu and getRangeContext api #576

This commit is contained in:
Hufe921
2024-05-18 20:56:58 +08:00
parent 28f6bdbb41
commit 149c95f952
6 changed files with 63 additions and 8 deletions
+12
View File
@@ -30,3 +30,15 @@ Usage:
```javascript
const contextMenuList = await instance.register.getContextMenuList()
```
Remark:
```javascript
// Example of modifying internal contextmenu
contextmenuList.forEach(menu => {
// Find the menu item through the menu key and modify its properties
if (menu.key === INTERNAL_CONTEXT_MENU_KEY.GLOBAL.PASTE) {
menu.when = () => false
}
})
```
+12
View File
@@ -30,3 +30,15 @@ instance.register.contextMenuList([
```javascript
const contextMenuList = await instance.register.getContextMenuList()
```
备注:
```javascript
// 修改内部右键菜单示例
contextmenuList.forEach(menu => {
// 通过菜单key找到菜单项后进行属性修改
if (menu.key === INTERNAL_CONTEXT_MENU_KEY.GLOBAL.PASTE) {
menu.when = () => false
}
})
```