Skip to content

Commit f944a0f

Browse files
committed
Remove contextMenuModule per default
Remove context menu module for now as it is not supported in VS Code (eclipse-glsp/glsp#414) and causes focus issues
1 parent 0b7b0dd commit f944a0f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/vscode-integration-webview/src/default-modules.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import { ModuleConfiguration } from '@eclipse-glsp/client';
17+
import { ModuleConfiguration, contextMenuModule } from '@eclipse-glsp/client';
1818
import { vscodeCopyPasteModule } from './features/copyPaste/copy-paste-module';
1919
import { vscodeDefaultModule } from './features/default/default-module';
2020
import { vscodeExportModule } from './features/export/export-module';
@@ -30,5 +30,6 @@ export const VSCODE_DEFAULT_MODULES = [
3030
] as const;
3131

3232
export const VSCODE_DEFAULT_MODULE_CONFIG: ModuleConfiguration = {
33-
add: [...VSCODE_DEFAULT_MODULES]
33+
add: [...VSCODE_DEFAULT_MODULES],
34+
remove: [contextMenuModule]
3435
};

packages/vscode-integration-webview/src/glsp-diagram-widget.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,17 @@ export abstract class GLSPDiagramWidget {
7373
containerDiv.addEventListener('mouseleave', e => this.handleMouseLeave(e));
7474
window.addEventListener('focus', e => this.handleFocusChange(e, true));
7575
window.addEventListener('blur', e => this.handleFocusChange(e, false));
76+
window.addEventListener('contextmenu', e => this.handleContextMenu(e));
7677
}
7778
}
7879

80+
handleContextMenu(e: MouseEvent): void {
81+
// Prevent the default context menu for now
82+
// Should be removed once we provide a proper context menu integration
83+
e.preventDefault();
84+
window.focus();
85+
}
86+
7987
handleMouseEnter(e: MouseEvent): void {
8088
this.containerDiv?.classList.add('mouse-enter');
8189
this.containerDiv?.classList.remove('mouse-leave');

0 commit comments

Comments
 (0)