payload-plugin-newsletter 0.25.2 → 0.25.3
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/CHANGELOG.md +9 -0
- package/dist/collections.cjs +44 -0
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +44 -0
- package/dist/collections.js.map +1 -1
- package/dist/server.js +44 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.25.3] - 2025-08-16
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
- Media population support for upload nodes within rich text fields in custom blocks
|
|
5
|
+
- Rich text fields in custom blocks now properly populate nested image uploads for email rendering
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Images inserted in rich text editors within custom blocks now render correctly in email previews
|
|
9
|
+
|
|
1
10
|
## [0.25.2] - 2025-08-15
|
|
2
11
|
|
|
3
12
|
### Fixed
|
package/dist/collections.cjs
CHANGED
|
@@ -1851,6 +1851,10 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
}
|
|
1853
1853
|
}
|
|
1854
|
+
if (field.type === "richText" && node.fields[field.name]) {
|
|
1855
|
+
await populateRichTextUploads(node.fields[field.name], payload);
|
|
1856
|
+
payload.logger?.info(`Processed rich text field ${field.name} for upload nodes`);
|
|
1857
|
+
}
|
|
1854
1858
|
}
|
|
1855
1859
|
}
|
|
1856
1860
|
}
|
|
@@ -1860,6 +1864,46 @@ async function populateBlockMediaFields(node, payload, config) {
|
|
|
1860
1864
|
}
|
|
1861
1865
|
}
|
|
1862
1866
|
}
|
|
1867
|
+
async function populateRichTextUploads(content, payload) {
|
|
1868
|
+
if (!content || typeof content !== "object") return;
|
|
1869
|
+
if (content.root?.children) {
|
|
1870
|
+
await processNodeArray(content.root.children);
|
|
1871
|
+
}
|
|
1872
|
+
if (Array.isArray(content)) {
|
|
1873
|
+
await processNodeArray(content);
|
|
1874
|
+
}
|
|
1875
|
+
async function processNodeArray(nodes) {
|
|
1876
|
+
await Promise.all(nodes.map(processNode));
|
|
1877
|
+
}
|
|
1878
|
+
async function processNode(node) {
|
|
1879
|
+
if (!node || typeof node !== "object") return;
|
|
1880
|
+
if (node.type === "upload" && node.relationTo === "media" && typeof node.value === "string" && node.value.match(/^[a-f0-9]{24}$/i)) {
|
|
1881
|
+
try {
|
|
1882
|
+
const media = await payload.findByID({
|
|
1883
|
+
collection: "media",
|
|
1884
|
+
id: node.value,
|
|
1885
|
+
depth: 0
|
|
1886
|
+
});
|
|
1887
|
+
if (media) {
|
|
1888
|
+
node.value = media;
|
|
1889
|
+
payload.logger?.info(`Populated rich text upload node:`, {
|
|
1890
|
+
mediaId: node.value,
|
|
1891
|
+
mediaUrl: media.url,
|
|
1892
|
+
filename: media.filename
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
} catch (error) {
|
|
1896
|
+
payload.logger?.error(`Failed to populate rich text upload ${node.value}:`, error);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
if (node.children && Array.isArray(node.children)) {
|
|
1900
|
+
await processNodeArray(node.children);
|
|
1901
|
+
}
|
|
1902
|
+
if (node.root?.children && Array.isArray(node.root.children)) {
|
|
1903
|
+
await processNodeArray(node.root.children);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1863
1907
|
var createBroadcastPreviewEndpoint = (config, _collectionSlug) => {
|
|
1864
1908
|
return {
|
|
1865
1909
|
path: "/preview",
|