Skip to content

Commit

Permalink
Remove contextMenuModule per default
Browse files Browse the repository at this point in the history
Remove context menu module for now as it is not supported in VS Code (eclipse-glsp/glsp#414)
 and causes focus issues
  • Loading branch information
tortmayr committed Jun 24, 2024
1 parent 0b7b0dd commit b0b15ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vscode-integration-webview/src/default-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

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

export const VSCODE_DEFAULT_MODULE_CONFIG: ModuleConfiguration = {
add: [...VSCODE_DEFAULT_MODULES]
add: [...VSCODE_DEFAULT_MODULES],
remove: [contextMenuModule]
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,17 @@ export abstract class GLSPDiagramWidget {
containerDiv.addEventListener('mouseleave', e => this.handleMouseLeave(e));
window.addEventListener('focus', e => this.handleFocusChange(e, true));
window.addEventListener('blur', e => this.handleFocusChange(e, false));
window.addEventListener('contextmenu', e => this.handleContextMenu(e));
}
}

handleContextMenu(e: MouseEvent): void {
// Prevent the default context menu for now
// Should be removed once we provide a proper context menu integration
e.preventDefault();
window.focus();
}

handleMouseEnter(e: MouseEvent): void {
this.containerDiv?.classList.add('mouse-enter');
this.containerDiv?.classList.remove('mouse-leave');
Expand Down

0 comments on commit b0b15ed

Please sign in to comment.