@orion-studios/payload-studio 0.6.0-beta.24 → 0.6.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/client.js +345 -102
- package/dist/admin/client.mjs +337 -94
- package/dist/studio-pages/client.js +26 -4
- package/dist/studio-pages/client.mjs +26 -4
- package/package.json +1 -1
|
@@ -930,6 +930,12 @@ var toMediaLibraryItem = (value) => {
|
|
|
930
930
|
};
|
|
931
931
|
};
|
|
932
932
|
var mediaLabel = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
933
|
+
var findMediaLibraryItem = (library, id) => {
|
|
934
|
+
if (id === null) {
|
|
935
|
+
return null;
|
|
936
|
+
}
|
|
937
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
938
|
+
};
|
|
933
939
|
var groupLabel = (key) => commonInspectorGroups.find((group) => group.key === key)?.label || key;
|
|
934
940
|
function BlockInspectorRenderer({
|
|
935
941
|
block,
|
|
@@ -1053,8 +1059,9 @@ function BlockInspectorRenderer({
|
|
|
1053
1059
|
title: group.label,
|
|
1054
1060
|
children: /* @__PURE__ */ jsxs3("div", { className: "orion-builder-settings-field-list", children: [
|
|
1055
1061
|
group.key === "media" ? effectiveMediaSources.map((source) => {
|
|
1056
|
-
const selectedSourceMedia = toMediaLibraryItem(source.value);
|
|
1057
1062
|
const selectedSourceMediaID = getRelationID(source.value);
|
|
1063
|
+
const selectedRelationMedia = toMediaLibraryItem(source.value);
|
|
1064
|
+
const selectedSourceMedia = selectedRelationMedia ?? findMediaLibraryItem(source.library, selectedSourceMediaID);
|
|
1058
1065
|
const sourceOptions = selectedSourceMedia && !source.library.some((item) => String(item.id) === String(selectedSourceMedia.id)) ? [selectedSourceMedia, ...source.library] : source.library;
|
|
1059
1066
|
return /* @__PURE__ */ jsxs3(
|
|
1060
1067
|
"div",
|
|
@@ -1079,6 +1086,10 @@ function BlockInspectorRenderer({
|
|
|
1079
1086
|
}
|
|
1080
1087
|
)
|
|
1081
1088
|
] }),
|
|
1089
|
+
selectedSourceMedia?.alt ? /* @__PURE__ */ jsxs3("label", { className: "orion-builder-settings-label", children: [
|
|
1090
|
+
"Media Description",
|
|
1091
|
+
/* @__PURE__ */ jsx3("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedSourceMedia.alt })
|
|
1092
|
+
] }) : selectedSourceMediaID !== null ? /* @__PURE__ */ jsx3("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
1082
1093
|
/* @__PURE__ */ jsx3(
|
|
1083
1094
|
"button",
|
|
1084
1095
|
{
|
|
@@ -2878,6 +2889,12 @@ var toMediaLibraryItem2 = (value) => {
|
|
|
2878
2889
|
};
|
|
2879
2890
|
};
|
|
2880
2891
|
var mediaLabel2 = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
2892
|
+
var findMediaLibraryItem2 = (library, id) => {
|
|
2893
|
+
if (id === null) {
|
|
2894
|
+
return null;
|
|
2895
|
+
}
|
|
2896
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
2897
|
+
};
|
|
2881
2898
|
var normalizeImageFit = (value) => value === "contain" ? "contain" : "cover";
|
|
2882
2899
|
var normalizeImageCornerStyle = (value) => value === "square" ? "square" : "rounded";
|
|
2883
2900
|
var getItemMediaSettings = (item) => {
|
|
@@ -2968,8 +2985,9 @@ function ItemMediaControl({
|
|
|
2968
2985
|
uploadLabel,
|
|
2969
2986
|
uploading
|
|
2970
2987
|
}) {
|
|
2971
|
-
const selectedMedia = toMediaLibraryItem2(item[fieldName]);
|
|
2972
2988
|
const selectedMediaID = getRelationID2(item[fieldName]);
|
|
2989
|
+
const selectedRelationMedia = toMediaLibraryItem2(item[fieldName]);
|
|
2990
|
+
const selectedMedia = selectedRelationMedia ?? findMediaLibraryItem2(mediaLibrary, selectedMediaID);
|
|
2973
2991
|
const directImageURL = normalizeText(item[imageURLFieldName]);
|
|
2974
2992
|
const previewURL = selectedMedia?.url || directImageURL;
|
|
2975
2993
|
const mediaSettings = getItemMediaSettings(item);
|
|
@@ -3015,6 +3033,10 @@ function ItemMediaControl({
|
|
|
3015
3033
|
}
|
|
3016
3034
|
)
|
|
3017
3035
|
] }),
|
|
3036
|
+
selectedMedia?.alt ? /* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
3037
|
+
"Media Description",
|
|
3038
|
+
/* @__PURE__ */ jsx12("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedMedia.alt })
|
|
3039
|
+
] }) : selectedMediaID !== null ? /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
3018
3040
|
/* @__PURE__ */ jsx12(
|
|
3019
3041
|
"button",
|
|
3020
3042
|
{
|
|
@@ -6848,12 +6870,12 @@ function BuilderPageEditor({
|
|
|
6848
6870
|
}
|
|
6849
6871
|
) : null,
|
|
6850
6872
|
/* @__PURE__ */ jsxs12("label", { style: sidebarLabelStyle, children: [
|
|
6851
|
-
"Upload Alt Text",
|
|
6873
|
+
"New Upload Alt Text",
|
|
6852
6874
|
/* @__PURE__ */ jsx13(
|
|
6853
6875
|
"input",
|
|
6854
6876
|
{
|
|
6855
6877
|
onChange: (event) => setUploadAltText(event.target.value),
|
|
6856
|
-
placeholder: "
|
|
6878
|
+
placeholder: "Used only when uploading a new image",
|
|
6857
6879
|
style: sidebarInputStyle,
|
|
6858
6880
|
type: "text",
|
|
6859
6881
|
value: uploadAltText
|
package/package.json
CHANGED