Skip to content

Commit

Permalink
disable interactive elements of CodeEditor in readOnly mode
Browse files Browse the repository at this point in the history
  • Loading branch information
keithjgrant committed Feb 19, 2021
1 parent a253fd0 commit 9922fca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions awx/ui_next/src/components/CodeEditor/CodeEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ const AceEditor = styled(ReactAce)`
background: var(--pf-c-form-control--invalid--Background);
border-bottom-width: var(--pf-c-form-control--invalid--BorderBottomWidth);
}`}
${props =>
props.setOptions.readOnly &&
`
&& .ace_cursor {
opacity: 0;
}
`}
`;
AceEditor.displayName = 'AceEditor';

Expand Down Expand Up @@ -132,6 +140,8 @@ function CodeEditor({
hasErrors={hasErrors}
setOptions={{
readOnly,
highlightActiveLine: !readOnly,
highlightGutterLine: !readOnly,
useWorker: false,
}}
commands={[
Expand Down

0 comments on commit 9922fca

Please sign in to comment.