-
-
-
-
-
{
- setImageUrl(e.target.value);
- setUrlError(null);
- }}
- onKeyDown={handleUrlKeyDown}
- className="ps-9"
- />
+ {/* URL Input (image pickers only — probes image dimensions) */}
+ {!hideUrlInput && (
+ <>
+
+
+
+
+
+ {
+ setImageUrl(e.target.value);
+ setUrlError(null);
+ }}
+ onKeyDown={handleUrlKeyDown}
+ className="ps-9"
+ />
+
+
+
+ {urlError &&
{urlError}
}
-
-
- {urlError &&
{urlError}
}
-
- {/* Divider with "or" */}
-
-
-
-
-
- {t`or choose from library`}
-
-
+ {/* Divider with "or" */}
+
+
+
+
+
+ {t`or choose from library`}
+
+
+ >
+ )}
{/* Provider Tabs */}
{providerTabs.length > 1 && (
@@ -487,13 +511,13 @@ export function MediaPickerModal({
) : items.length === 0 ? (
-
+
{t`No media found`}
{canSearch && searchQuery
? t`Try a different search term`
: canUpload
- ? t`Upload an image to get started`
+ ? emptyStateUploadHint
: t`No media available from this provider`}
{canUpload && !searchQuery && (
@@ -502,7 +526,7 @@ export function MediaPickerModal({
icon={
}
onClick={() => fileInputRef.current?.click()}
>
- {t`Upload Image`}
+ {emptyStateUploadCta}
)}
diff --git a/packages/admin/tests/components/ContentEditor.test.tsx b/packages/admin/tests/components/ContentEditor.test.tsx
index 6b9416617..5fbaf099b 100644
--- a/packages/admin/tests/components/ContentEditor.test.tsx
+++ b/packages/admin/tests/components/ContentEditor.test.tsx
@@ -304,6 +304,247 @@ describe("ContentEditor", () => {
await expect.element(all[2]!).toBeChecked();
});
+ it("renders file fields with a Select file button (not a plain text input)", async () => {
+ // Regression test for #718: the "file" field kind used to fall through to the
+ // default case and render a text input, making it impossible to actually attach
+ // a file. It must render a media picker trigger instead.
+ const screen = await renderEditor({
+ fields: { attachment: { kind: "file", label: "Attachment" } },
+ isNew: true,
+ });
+
+ // The button that opens the picker should be present and labeled with the
+ // field's label (accessibility).
+ const selectBtn = screen.getByRole("button", { name: /Select Attachment/i });
+ await expect.element(selectBtn).toBeInTheDocument();
+
+ // And there must not be a text input inside the file field region — the old
+ // bug rendered an `