feat:add hyperlink contextmenu
This commit is contained in:
@@ -8,6 +8,7 @@ import { Position } from '../position/Position'
|
|||||||
import { RangeManager } from '../range/RangeManager'
|
import { RangeManager } from '../range/RangeManager'
|
||||||
import { controlMenus } from './menus/controlMenus'
|
import { controlMenus } from './menus/controlMenus'
|
||||||
import { globalMenus } from './menus/globalMenus'
|
import { globalMenus } from './menus/globalMenus'
|
||||||
|
import { hyperlinkMenus } from './menus/hyperlinkMenus'
|
||||||
import { imageMenus } from './menus/imageMenus'
|
import { imageMenus } from './menus/imageMenus'
|
||||||
import { tableMenus } from './menus/tableMenus'
|
import { tableMenus } from './menus/tableMenus'
|
||||||
|
|
||||||
@@ -40,7 +41,8 @@ export class ContextMenu {
|
|||||||
...globalMenus,
|
...globalMenus,
|
||||||
...tableMenus,
|
...tableMenus,
|
||||||
...imageMenus,
|
...imageMenus,
|
||||||
...controlMenus
|
...controlMenus,
|
||||||
|
...hyperlinkMenus
|
||||||
]
|
]
|
||||||
this.contextMenuContainerList = []
|
this.contextMenuContainerList = []
|
||||||
this.contextMenuRelationShip = new Map()
|
this.contextMenuRelationShip = new Map()
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { ElementType } from '../../../dataset/enum/Element'
|
||||||
|
import { IRegisterContextMenu } from '../../../interface/contextmenu/ContextMenu'
|
||||||
|
import { Command } from '../../command/Command'
|
||||||
|
|
||||||
|
export const hyperlinkMenus: IRegisterContextMenu[] = [
|
||||||
|
{
|
||||||
|
name: '删除链接',
|
||||||
|
when: (payload) => {
|
||||||
|
return payload.startElement?.type === ElementType.HYPERLINK
|
||||||
|
},
|
||||||
|
callback: (command: Command) => {
|
||||||
|
console.log('command: ', command)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '取消链接',
|
||||||
|
when: (payload) => {
|
||||||
|
return payload.startElement?.type === ElementType.HYPERLINK
|
||||||
|
},
|
||||||
|
callback: (command: Command) => {
|
||||||
|
console.log('command: ', command)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '打开链接',
|
||||||
|
when: (payload) => {
|
||||||
|
return payload.startElement?.type === ElementType.HYPERLINK
|
||||||
|
},
|
||||||
|
callback: (command: Command) => {
|
||||||
|
console.log('command: ', command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user