mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
disable context menu override (#7431)
This commit is contained in:
parent
cb7e5896c4
commit
7abe25c3f2
@ -103,6 +103,7 @@ export interface CodeEditorProps {
|
|||||||
// NOTE: for caching scroll and marks
|
// NOTE: for caching scroll and marks
|
||||||
uniquenessKey?: string;
|
uniquenessKey?: string;
|
||||||
updateFilter?: (filter: string) => void;
|
updateFilter?: (filter: string) => void;
|
||||||
|
disableContextMenu?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizeMimeType = (mode?: string) => {
|
const normalizeMimeType = (mode?: string) => {
|
||||||
@ -171,6 +172,7 @@ export const CodeEditor = memo(forwardRef<CodeEditorHandle, CodeEditorProps>(({
|
|||||||
style,
|
style,
|
||||||
uniquenessKey,
|
uniquenessKey,
|
||||||
updateFilter,
|
updateFilter,
|
||||||
|
disableContextMenu,
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
@ -570,7 +572,7 @@ export const CodeEditor = memo(forwardRef<CodeEditorHandle, CodeEditorProps>(({
|
|||||||
data-editor-type="text"
|
data-editor-type="text"
|
||||||
data-testid="CodeEditor"
|
data-testid="CodeEditor"
|
||||||
onContextMenu={event => {
|
onContextMenu={event => {
|
||||||
if (readOnly) {
|
if (readOnly || disableContextMenu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -201,11 +201,11 @@ export const PreRequestScriptEditor: FC<Props> = ({
|
|||||||
<CodeEditor
|
<CodeEditor
|
||||||
key={uniquenessKey}
|
key={uniquenessKey}
|
||||||
id="pre-request-script-editor"
|
id="pre-request-script-editor"
|
||||||
|
disableContextMenu={true}
|
||||||
showPrettifyButton={true}
|
showPrettifyButton={true}
|
||||||
uniquenessKey={uniquenessKey}
|
uniquenessKey={uniquenessKey}
|
||||||
defaultValue={defaultValue}
|
defaultValue={defaultValue}
|
||||||
className={className}
|
className={className}
|
||||||
// enableNunjucks
|
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
mode='text/javascript'
|
mode='text/javascript'
|
||||||
placeholder="..."
|
placeholder="..."
|
||||||
|
Loading…
Reference in New Issue
Block a user