Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable context menu override #7431

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading