disable interactive elements of CodeEditor in readOnly mode

This commit is contained in:
Keith J. Grant
2021-02-19 15:30:27 -08:00
parent 411d69204b
commit 221021a798

View File

@@ -44,6 +44,14 @@ const AceEditor = styled(ReactAce)`
background: var(--pf-c-form-control--invalid--Background); background: var(--pf-c-form-control--invalid--Background);
border-bottom-width: var(--pf-c-form-control--invalid--BorderBottomWidth); border-bottom-width: var(--pf-c-form-control--invalid--BorderBottomWidth);
}`} }`}
${props =>
props.setOptions.readOnly &&
`
&& .ace_cursor {
opacity: 0;
}
`}
`; `;
AceEditor.displayName = 'AceEditor'; AceEditor.displayName = 'AceEditor';
@@ -132,6 +140,8 @@ function CodeEditor({
hasErrors={hasErrors} hasErrors={hasErrors}
setOptions={{ setOptions={{
readOnly, readOnly,
highlightActiveLine: !readOnly,
highlightGutterLine: !readOnly,
useWorker: false, useWorker: false,
}} }}
commands={[ commands={[