Skip to content

Commit

Permalink
disable context menu override (Kong#7431)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkav authored and stefancruz committed Jun 30, 2024
1 parent 81655b9 commit 1702a99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -171,6 +172,7 @@ export const CodeEditor = memo(forwardRef<CodeEditorHandle, CodeEditorProps>(({
style,
uniquenessKey,
updateFilter,
disableContextMenu,
}, ref) => {
const inputRef = useRef<HTMLInputElement>(null);
const textAreaRef = useRef<HTMLTextAreaElement>(null);
Expand Down Expand Up @@ -570,7 +572,7 @@ export const CodeEditor = memo(forwardRef<CodeEditorHandle, CodeEditorProps>(({
data-editor-type="text"
data-testid="CodeEditor"
onContextMenu={event => {
if (readOnly) {
if (readOnly || disableContextMenu) {
return;
}
event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ export const PreRequestScriptEditor: FC<Props> = ({
<CodeEditor
key={uniquenessKey}
id="pre-request-script-editor"
disableContextMenu={true}
showPrettifyButton={true}
uniquenessKey={uniquenessKey}
defaultValue={defaultValue}
className={className}
// enableNunjucks
onChange={onChange}
mode='text/javascript'
placeholder="..."
Expand Down

0 comments on commit 1702a99

Please sign in to comment.