This commit is contained in:
@@ -65,6 +65,7 @@ function createImageFieldState(
|
||||
url: "",
|
||||
label,
|
||||
kind: MediaKind.IMAGE,
|
||||
isCleared: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,6 +76,7 @@ function createImageFieldState(
|
||||
url,
|
||||
label,
|
||||
kind: MediaKind.IMAGE,
|
||||
isCleared: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +86,7 @@ function createImageFieldState(
|
||||
url: "",
|
||||
label,
|
||||
kind: MediaKind.IMAGE,
|
||||
isCleared: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -92,6 +95,10 @@ function getMediaPreviewUrl(
|
||||
options: MediaOption[],
|
||||
fallbackUrl: string | null | undefined,
|
||||
) {
|
||||
if (value.isCleared) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (value.mode === "external") {
|
||||
return value.url || fallbackUrl || "";
|
||||
}
|
||||
@@ -280,12 +287,20 @@ export function SiteSettingsForm({
|
||||
value={favicon}
|
||||
onChange={setFavicon}
|
||||
options={mediaOptions}
|
||||
hasInitialValue={Boolean(initialBindings.favicon?.assetId || initialBindings.favicon?.url)}
|
||||
inputName="faviconMedia"
|
||||
fileFieldName="faviconFile"
|
||||
fileLabel="Upload Favicon"
|
||||
externalLabel="Favicon URL"
|
||||
libraryLabel="Favicon Library"
|
||||
accept=".png,.svg,.ico,image/png,image/svg+xml,image/x-icon,image/vnd.microsoft.icon"
|
||||
allowExternal={false}
|
||||
allowClear
|
||||
clearLabel="Remove Favicon"
|
||||
emptyValue={{
|
||||
mode: "upload",
|
||||
assetId: "",
|
||||
url: "",
|
||||
}}
|
||||
/>
|
||||
|
||||
<MediaFieldPicker
|
||||
@@ -293,12 +308,20 @@ export function SiteSettingsForm({
|
||||
value={defaultOgImage}
|
||||
onChange={setDefaultOgImage}
|
||||
options={mediaOptions}
|
||||
hasInitialValue={Boolean(initialBindings.defaultOgImage?.assetId || initialBindings.defaultOgImage?.url)}
|
||||
inputName="defaultOgImageMedia"
|
||||
fileFieldName="defaultOgImageFile"
|
||||
fileLabel="Upload OG Image"
|
||||
externalLabel="OG Image URL"
|
||||
libraryLabel="OG Image Library"
|
||||
accept="image/*,.svg"
|
||||
allowExternal={false}
|
||||
allowClear
|
||||
clearLabel="Remove OG Image"
|
||||
emptyValue={{
|
||||
mode: "upload",
|
||||
assetId: "",
|
||||
url: "",
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
|
||||
Reference in New Issue
Block a user