@marvalt/wparser 0.1.18 → 0.1.19
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/index.cjs +33 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +33 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/defaultRegistry.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1888,12 +1888,24 @@ const Column = ({ block, children }) => {
|
|
|
1888
1888
|
const Separator = () => jsxRuntimeExports.jsx("hr", { className: "border-gray-200 my-8" });
|
|
1889
1889
|
const ButtonBlock = ({ block }) => {
|
|
1890
1890
|
const attrs = block.attributes || {};
|
|
1891
|
-
|
|
1892
|
-
|
|
1891
|
+
let url = attrs['url'];
|
|
1892
|
+
let text = attrs['text'];
|
|
1893
1893
|
attrs['linkDestination'];
|
|
1894
|
+
// Extract from innerHTML if not in attributes (buttons often store data in innerHTML)
|
|
1895
|
+
if (!url && block.innerHTML) {
|
|
1896
|
+
const linkMatch = block.innerHTML.match(/<a[^>]+href=["']([^"']+)["'][^>]*>([^<]+)<\/a>/i);
|
|
1897
|
+
if (linkMatch) {
|
|
1898
|
+
url = linkMatch[1];
|
|
1899
|
+
text = linkMatch[2] || text;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
// Get text from block content if still missing
|
|
1903
|
+
if (!text) {
|
|
1904
|
+
text = getBlockTextContent(block);
|
|
1905
|
+
}
|
|
1894
1906
|
if (!url && !text)
|
|
1895
1907
|
return null;
|
|
1896
|
-
const buttonText = text ||
|
|
1908
|
+
const buttonText = text || 'Learn more';
|
|
1897
1909
|
// Handle internal vs external links
|
|
1898
1910
|
const isExternal = url && (url.startsWith('http://') || url.startsWith('https://'));
|
|
1899
1911
|
const linkProps = isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {};
|
|
@@ -1967,19 +1979,34 @@ const MediaText = ({ block, children, context }) => {
|
|
|
1967
1979
|
const finalImageUrl = isCloudflareImageUrl(imageUrl)
|
|
1968
1980
|
? getCloudflareVariantUrl(imageUrl, { width: 1024 })
|
|
1969
1981
|
: imageUrl;
|
|
1970
|
-
mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg object-cover", loading: "lazy" }));
|
|
1982
|
+
mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", loading: "lazy" }));
|
|
1971
1983
|
}
|
|
1972
1984
|
}
|
|
1973
1985
|
// Content is all other children
|
|
1974
1986
|
const contentElements = childrenArray.filter((_, index) => index !== mediaBlockIndex);
|
|
1975
1987
|
// Build alignment classes - ensure proper container width
|
|
1976
|
-
// For 'wide',
|
|
1988
|
+
// For 'wide', check if we're inside a constrained group context
|
|
1989
|
+
// If innerBlocks contain a group with constrained layout, the parent likely has constrained layout too
|
|
1990
|
+
// In that case, use w-full to fill the parent container (which is already boxed)
|
|
1991
|
+
// Otherwise, use max-w-7xl for standalone wide blocks
|
|
1977
1992
|
let alignClass;
|
|
1978
1993
|
if (align === 'full') {
|
|
1979
1994
|
alignClass = 'w-full';
|
|
1980
1995
|
}
|
|
1981
1996
|
else if (align === 'wide') {
|
|
1982
|
-
|
|
1997
|
+
// Check if media-text content is wrapped in a constrained group
|
|
1998
|
+
// This indicates the block is in a constrained layout context
|
|
1999
|
+
// In that case, fill the parent container (which is already boxed) rather than applying another container
|
|
2000
|
+
const hasConstrainedGroup = innerBlocks.some((b) => {
|
|
2001
|
+
if (b.name === 'core/group') {
|
|
2002
|
+
const groupLayout = b.attributes?.layout;
|
|
2003
|
+
return groupLayout?.type === 'constrained';
|
|
2004
|
+
}
|
|
2005
|
+
return false;
|
|
2006
|
+
});
|
|
2007
|
+
// If we have a constrained group in innerBlocks, use w-full to fill parent container
|
|
2008
|
+
// Otherwise, use max-w-7xl for standalone wide blocks
|
|
2009
|
+
alignClass = hasConstrainedGroup ? 'w-full' : 'max-w-7xl mx-auto';
|
|
1983
2010
|
}
|
|
1984
2011
|
else {
|
|
1985
2012
|
// Default to contained width (not full width)
|