From 7abe25c3f2e807355a66415b6cfd68f425c35f06 Mon Sep 17 00:00:00 2001 From: Jack Kavanagh Date: Tue, 21 May 2024 19:14:52 +0200 Subject: [PATCH] disable context menu override (#7431) --- .../insomnia/src/ui/components/codemirror/code-editor.tsx | 4 +++- .../src/ui/components/editors/pre-request-script-editor.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx index 2760b52b7..6743cd81c 100644 --- a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx +++ b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx @@ -103,6 +103,7 @@ export interface CodeEditorProps { // NOTE: for caching scroll and marks uniquenessKey?: string; updateFilter?: (filter: string) => void; + disableContextMenu?: boolean; } const normalizeMimeType = (mode?: string) => { @@ -171,6 +172,7 @@ export const CodeEditor = memo(forwardRef(({ style, uniquenessKey, updateFilter, + disableContextMenu, }, ref) => { const inputRef = useRef(null); const textAreaRef = useRef(null); @@ -570,7 +572,7 @@ export const CodeEditor = memo(forwardRef(({ data-editor-type="text" data-testid="CodeEditor" onContextMenu={event => { - if (readOnly) { + if (readOnly || disableContextMenu) { return; } event.preventDefault(); diff --git a/packages/insomnia/src/ui/components/editors/pre-request-script-editor.tsx b/packages/insomnia/src/ui/components/editors/pre-request-script-editor.tsx index 675c99702..c8631b86c 100644 --- a/packages/insomnia/src/ui/components/editors/pre-request-script-editor.tsx +++ b/packages/insomnia/src/ui/components/editors/pre-request-script-editor.tsx @@ -201,11 +201,11 @@ export const PreRequestScriptEditor: FC = ({