@orion-studios/payload-studio 0.6.0-beta.24 → 0.6.0-beta.25
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.
|
@@ -957,6 +957,12 @@ var toMediaLibraryItem = (value) => {
|
|
|
957
957
|
};
|
|
958
958
|
};
|
|
959
959
|
var mediaLabel = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
960
|
+
var findMediaLibraryItem = (library, id) => {
|
|
961
|
+
if (id === null) {
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
965
|
+
};
|
|
960
966
|
var groupLabel = (key) => commonInspectorGroups.find((group) => group.key === key)?.label || key;
|
|
961
967
|
function BlockInspectorRenderer({
|
|
962
968
|
block,
|
|
@@ -1080,8 +1086,9 @@ function BlockInspectorRenderer({
|
|
|
1080
1086
|
title: group.label,
|
|
1081
1087
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-builder-settings-field-list", children: [
|
|
1082
1088
|
group.key === "media" ? effectiveMediaSources.map((source) => {
|
|
1083
|
-
const selectedSourceMedia = toMediaLibraryItem(source.value);
|
|
1084
1089
|
const selectedSourceMediaID = getRelationID(source.value);
|
|
1090
|
+
const selectedRelationMedia = toMediaLibraryItem(source.value);
|
|
1091
|
+
const selectedSourceMedia = selectedRelationMedia ?? findMediaLibraryItem(source.library, selectedSourceMediaID);
|
|
1085
1092
|
const sourceOptions = selectedSourceMedia && !source.library.some((item) => String(item.id) === String(selectedSourceMedia.id)) ? [selectedSourceMedia, ...source.library] : source.library;
|
|
1086
1093
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1087
1094
|
"div",
|
|
@@ -1106,6 +1113,10 @@ function BlockInspectorRenderer({
|
|
|
1106
1113
|
}
|
|
1107
1114
|
)
|
|
1108
1115
|
] }),
|
|
1116
|
+
selectedSourceMedia?.alt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
1117
|
+
"Media Description",
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedSourceMedia.alt })
|
|
1119
|
+
] }) : selectedSourceMediaID !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
1109
1120
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1110
1121
|
"button",
|
|
1111
1122
|
{
|
|
@@ -2998,6 +3009,12 @@ var toMediaLibraryItem2 = (value) => {
|
|
|
2998
3009
|
};
|
|
2999
3010
|
};
|
|
3000
3011
|
var mediaLabel2 = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
3012
|
+
var findMediaLibraryItem2 = (library, id) => {
|
|
3013
|
+
if (id === null) {
|
|
3014
|
+
return null;
|
|
3015
|
+
}
|
|
3016
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
3017
|
+
};
|
|
3001
3018
|
var normalizeImageFit = (value) => value === "contain" ? "contain" : "cover";
|
|
3002
3019
|
var normalizeImageCornerStyle = (value) => value === "square" ? "square" : "rounded";
|
|
3003
3020
|
var getItemMediaSettings = (item) => {
|
|
@@ -3088,8 +3105,9 @@ function ItemMediaControl({
|
|
|
3088
3105
|
uploadLabel,
|
|
3089
3106
|
uploading
|
|
3090
3107
|
}) {
|
|
3091
|
-
const selectedMedia = toMediaLibraryItem2(item[fieldName]);
|
|
3092
3108
|
const selectedMediaID = getRelationID2(item[fieldName]);
|
|
3109
|
+
const selectedRelationMedia = toMediaLibraryItem2(item[fieldName]);
|
|
3110
|
+
const selectedMedia = selectedRelationMedia ?? findMediaLibraryItem2(mediaLibrary, selectedMediaID);
|
|
3093
3111
|
const directImageURL = normalizeText(item[imageURLFieldName]);
|
|
3094
3112
|
const previewURL = selectedMedia?.url || directImageURL;
|
|
3095
3113
|
const mediaSettings = getItemMediaSettings(item);
|
|
@@ -3135,6 +3153,10 @@ function ItemMediaControl({
|
|
|
3135
3153
|
}
|
|
3136
3154
|
)
|
|
3137
3155
|
] }),
|
|
3156
|
+
selectedMedia?.alt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
3157
|
+
"Media Description",
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedMedia.alt })
|
|
3159
|
+
] }) : selectedMediaID !== null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
3138
3160
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3139
3161
|
"button",
|
|
3140
3162
|
{
|
|
@@ -6968,12 +6990,12 @@ function BuilderPageEditor({
|
|
|
6968
6990
|
}
|
|
6969
6991
|
) : null,
|
|
6970
6992
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { style: sidebarLabelStyle, children: [
|
|
6971
|
-
"Upload Alt Text",
|
|
6993
|
+
"New Upload Alt Text",
|
|
6972
6994
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6973
6995
|
"input",
|
|
6974
6996
|
{
|
|
6975
6997
|
onChange: (event) => setUploadAltText(event.target.value),
|
|
6976
|
-
placeholder: "
|
|
6998
|
+
placeholder: "Used only when uploading a new image",
|
|
6977
6999
|
style: sidebarInputStyle,
|
|
6978
7000
|
type: "text",
|
|
6979
7001
|
value: uploadAltText
|
|
@@ -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