refactor(图表): 屏蔽表格右键默认菜单

This commit is contained in:
wisonic-s
2025-08-26 18:08:54 +08:00
committed by wisonic-s
parent 17f2ae098f
commit eaafad32a3
2 changed files with 12 additions and 0 deletions

View File

@@ -377,6 +377,12 @@ export class TableInfo extends S2ChartView<TableSheet> {
newChart.on(S2Event.GLOBAL_CONTEXT_MENU, event => copyContent(newChart, event, meta))
// touch
this.configTouchEvent(newChart, drawOption, meta)
// right click
newChart.once(S2Event.LAYOUT_AFTER_RENDER, () => {
newChart.getCanvasElement().addEventListener('contextmenu', e => {
e.preventDefault()
})
})
// theme
const customTheme = this.configTheme(chart)
newChart.setThemeCfg({ theme: customTheme })

View File

@@ -281,6 +281,12 @@ export class TableNormal extends S2ChartView<TableSheet> {
newChart.on(S2Event.GLOBAL_CONTEXT_MENU, event => copyContent(newChart, event, meta))
// touch
this.configTouchEvent(newChart, drawOption, meta)
// right click
newChart.once(S2Event.LAYOUT_AFTER_RENDER, () => {
newChart.getCanvasElement().addEventListener('contextmenu', e => {
e.preventDefault()
})
})
// theme
const customTheme = this.configTheme(chart)
newChart.setThemeCfg({ theme: customTheme })