Skip to content

Commit 61922a9

Browse files
fix(CodeeEditor): rendered file input when editor has content (#11725)
1 parent 3e107d4 commit 61922a9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/react-code-editor/src/components/CodeEditor/CodeEditor.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,12 @@ class CodeEditor extends Component<CodeEditorProps, CodeEditorState> {
696696
) : (
697697
<>
698698
{editorHeader}
699-
{showEditor && <div className={css(styles.codeEditorMain)}>{editor}</div>}
699+
{showEditor && (
700+
<div className={css(styles.codeEditorMain)}>
701+
{hiddenFileInput}
702+
{editor}
703+
</div>
704+
)}
700705
</>
701706
)}
702707
</div>

packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ exports[`Matches snapshot with control buttons enabled 1`] = `
110110
<div
111111
class="pf-v6-c-code-editor__main"
112112
>
113+
<input
114+
hidden=""
115+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
116+
tabindex="-1"
117+
type="file"
118+
/>
113119
<div
114120
class="pf-v6-c-code-editor__code"
115121
dir="ltr"
@@ -135,6 +141,12 @@ exports[`Matches snapshot without props 1`] = `
135141
<div
136142
class="pf-v6-c-code-editor__main"
137143
>
144+
<input
145+
hidden=""
146+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
147+
tabindex="-1"
148+
type="file"
149+
/>
138150
<div
139151
class="pf-v6-c-code-editor__code"
140152
dir="ltr"

0 commit comments

Comments
 (0)