mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
add id to code editor input fields
This commit is contained in:
@@ -96,11 +96,15 @@ function CodeEditor({
|
|||||||
useEffect(
|
useEffect(
|
||||||
function removeTextareaTabIndex() {
|
function removeTextareaTabIndex() {
|
||||||
const editorInput = editor.current.refEditor?.querySelector('textarea');
|
const editorInput = editor.current.refEditor?.querySelector('textarea');
|
||||||
if (editorInput && !readOnly) {
|
if (!editorInput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!readOnly) {
|
||||||
editorInput.tabIndex = -1;
|
editorInput.tabIndex = -1;
|
||||||
}
|
}
|
||||||
|
editorInput.id = id;
|
||||||
},
|
},
|
||||||
[readOnly]
|
[readOnly, id]
|
||||||
);
|
);
|
||||||
|
|
||||||
const listen = useCallback(event => {
|
const listen = useCallback(event => {
|
||||||
@@ -144,7 +148,7 @@ function CodeEditor({
|
|||||||
value={value}
|
value={value}
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
name={id || 'code-editor'}
|
name={`${id}-editor` || 'code-editor'}
|
||||||
editorProps={{ $blockScrolling: true }}
|
editorProps={{ $blockScrolling: true }}
|
||||||
fontSize={16}
|
fontSize={16}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ function VariablesFieldInternals({
|
|||||||
<label htmlFor={id} className="pf-c-form__label">
|
<label htmlFor={id} className="pf-c-form__label">
|
||||||
<span className="pf-c-form__label-text">{label}</span>
|
<span className="pf-c-form__label-text">{label}</span>
|
||||||
</label>
|
</label>
|
||||||
{tooltip && <Popover content={tooltip} id={id} />}
|
{tooltip && <Popover content={tooltip} id={`${id}-tooltip`} />}
|
||||||
</SplitItem>
|
</SplitItem>
|
||||||
<SplitItem>
|
<SplitItem>
|
||||||
<MultiButtonToggle
|
<MultiButtonToggle
|
||||||
@@ -210,6 +210,7 @@ function VariablesFieldInternals({
|
|||||||
)}
|
)}
|
||||||
</FieldHeader>
|
</FieldHeader>
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
|
id={id}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
{...field}
|
{...field}
|
||||||
|
|||||||
Reference in New Issue
Block a user