refactor:internal context menu register
This commit is contained in:
@@ -6,6 +6,9 @@ import { Command } from '../command/Command'
|
|||||||
import { Draw } from '../draw/Draw'
|
import { Draw } from '../draw/Draw'
|
||||||
import { Position } from '../position/Position'
|
import { Position } from '../position/Position'
|
||||||
import { RangeManager } from '../range/RangeManager'
|
import { RangeManager } from '../range/RangeManager'
|
||||||
|
import { globalMenus } from './menus/globalMenus'
|
||||||
|
import { imageMenus } from './menus/imageMenus'
|
||||||
|
import { tableMenus } from './menus/tableMenus'
|
||||||
|
|
||||||
interface IRenderPayload {
|
interface IRenderPayload {
|
||||||
contextMenuList: IRegisterContextMenu[];
|
contextMenuList: IRegisterContextMenu[];
|
||||||
@@ -31,7 +34,12 @@ export class ContextMenu {
|
|||||||
this.range = draw.getRange()
|
this.range = draw.getRange()
|
||||||
this.position = draw.getPosition()
|
this.position = draw.getPosition()
|
||||||
this.container = draw.getContainer()
|
this.container = draw.getContainer()
|
||||||
this.contextMenuList = []
|
// 内部菜单
|
||||||
|
this.contextMenuList = [
|
||||||
|
...globalMenus,
|
||||||
|
...tableMenus,
|
||||||
|
...imageMenus
|
||||||
|
]
|
||||||
this.contextMenuContainerList = []
|
this.contextMenuContainerList = []
|
||||||
this.contextMenuRelationShip = new Map()
|
this.contextMenuRelationShip = new Map()
|
||||||
// 接管菜单权限
|
// 接管菜单权限
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ import { RowFlex } from './dataset/enum/Row'
|
|||||||
import { ElementType } from './dataset/enum/Element'
|
import { ElementType } from './dataset/enum/Element'
|
||||||
import { formatElementList } from './utils/element'
|
import { formatElementList } from './utils/element'
|
||||||
import { Register } from './core/register/Register'
|
import { Register } from './core/register/Register'
|
||||||
import { globalMenus } from './core/contextmenu/menus/globalMenus'
|
|
||||||
import { ContextMenu } from './core/contextmenu/ContextMenu'
|
import { ContextMenu } from './core/contextmenu/ContextMenu'
|
||||||
import { tableMenus } from './core/contextmenu/menus/tableMenus'
|
|
||||||
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu'
|
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu'
|
||||||
import { EditorComponent, EditorMode, PageMode } from './dataset/enum/Editor'
|
import { EditorComponent, EditorMode, PageMode } from './dataset/enum/Editor'
|
||||||
import { EDITOR_COMPONENT } from './dataset/constant/Editor'
|
import { EDITOR_COMPONENT } from './dataset/constant/Editor'
|
||||||
@@ -25,7 +23,6 @@ import { IControlOption } from './interface/Control'
|
|||||||
import { ICheckboxOption } from './interface/Checkbox'
|
import { ICheckboxOption } from './interface/Checkbox'
|
||||||
import { defaultCheckboxOption } from './dataset/constant/Checkbox'
|
import { defaultCheckboxOption } from './dataset/constant/Checkbox'
|
||||||
import { DeepRequired } from './interface/Common'
|
import { DeepRequired } from './interface/Common'
|
||||||
import { imageMenus } from './core/contextmenu/menus/imageMenus'
|
|
||||||
|
|
||||||
export default class Editor {
|
export default class Editor {
|
||||||
|
|
||||||
@@ -104,9 +101,6 @@ export default class Editor {
|
|||||||
this.register = new Register({
|
this.register = new Register({
|
||||||
contextMenu
|
contextMenu
|
||||||
})
|
})
|
||||||
this.register.contextMenuList(globalMenus)
|
|
||||||
this.register.contextMenuList(tableMenus)
|
|
||||||
this.register.contextMenuList(imageMenus)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user