mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
editor: finish remove hack TODO
The upstream fix was merged, so the workaround is no longer needed.
This commit is contained in:
committed by
David Lechner
parent
764083e6be
commit
db438be40b
@@ -429,25 +429,6 @@ const Editor: React.VFC = () => {
|
||||
[],
|
||||
);
|
||||
|
||||
useEditor(
|
||||
editor,
|
||||
(editor) => {
|
||||
// TODO: can be removed when https://github.com/microsoft/vscode/pull/146968 is merged
|
||||
// HACK: The editor eats context menu key press events event when
|
||||
// the monaco context menu is disabled so we have to fake it
|
||||
const subscription = editor.onKeyDown((e) => {
|
||||
if (e.keyCode === monaco.KeyCode.ContextMenu) {
|
||||
e.target.dispatchEvent(
|
||||
new MouseEvent('contextmenu', { bubbles: true }),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return () => subscription.dispose();
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const handleEditorDidMount = useCallback<EditorDidMount>(
|
||||
(editor) => {
|
||||
editor.focus();
|
||||
|
||||
@@ -58,6 +58,10 @@ const specialCases: Record<string, string> = {
|
||||
function addWhichToKeyboardEvent(e: KeyboardEvent) {
|
||||
// blueprints and testing-library both don't do this one
|
||||
if (e.key === 'ContextMenu') {
|
||||
// HACK: work around lack of ContextMenu key support in user-events
|
||||
if (e.target !== null) {
|
||||
e.target.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user