@marvalt/wparser 0.1.18 → 0.1.20
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 +23 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +23 -7
- 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.cjs
CHANGED
|
@@ -1890,16 +1890,28 @@ const Column = ({ block, children }) => {
|
|
|
1890
1890
|
const Separator = () => jsxRuntimeExports.jsx("hr", { className: "border-gray-200 my-8" });
|
|
1891
1891
|
const ButtonBlock = ({ block }) => {
|
|
1892
1892
|
const attrs = block.attributes || {};
|
|
1893
|
-
|
|
1894
|
-
|
|
1893
|
+
let url = attrs['url'];
|
|
1894
|
+
let text = attrs['text'];
|
|
1895
1895
|
attrs['linkDestination'];
|
|
1896
|
+
// Extract from innerHTML if not in attributes (buttons often store data in innerHTML)
|
|
1897
|
+
if (!url && block.innerHTML) {
|
|
1898
|
+
const linkMatch = block.innerHTML.match(/<a[^>]+href=["']([^"']+)["'][^>]*>([^<]+)<\/a>/i);
|
|
1899
|
+
if (linkMatch) {
|
|
1900
|
+
url = linkMatch[1];
|
|
1901
|
+
text = linkMatch[2] || text;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
// Get text from block content if still missing
|
|
1905
|
+
if (!text) {
|
|
1906
|
+
text = getBlockTextContent(block);
|
|
1907
|
+
}
|
|
1896
1908
|
if (!url && !text)
|
|
1897
1909
|
return null;
|
|
1898
|
-
const buttonText = text ||
|
|
1910
|
+
const buttonText = text || 'Learn more';
|
|
1899
1911
|
// Handle internal vs external links
|
|
1900
1912
|
const isExternal = url && (url.startsWith('http://') || url.startsWith('https://'));
|
|
1901
1913
|
const linkProps = isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {};
|
|
1902
|
-
return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-
|
|
1914
|
+
return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-primary-foreground font-medium hover:bg-primary/90 transition-colors", ...linkProps, children: buttonText }));
|
|
1903
1915
|
};
|
|
1904
1916
|
const Cover = ({ block, children }) => {
|
|
1905
1917
|
const attrs = block.attributes || {};
|
|
@@ -1969,19 +1981,23 @@ const MediaText = ({ block, children, context }) => {
|
|
|
1969
1981
|
const finalImageUrl = isCloudflareImageUrl(imageUrl)
|
|
1970
1982
|
? getCloudflareVariantUrl(imageUrl, { width: 1024 })
|
|
1971
1983
|
: imageUrl;
|
|
1972
|
-
mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg object-cover", loading: "lazy" }));
|
|
1984
|
+
mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", loading: "lazy" }));
|
|
1973
1985
|
}
|
|
1974
1986
|
}
|
|
1975
1987
|
// Content is all other children
|
|
1976
1988
|
const contentElements = childrenArray.filter((_, index) => index !== mediaBlockIndex);
|
|
1977
1989
|
// Build alignment classes - ensure proper container width
|
|
1978
|
-
// For 'wide',
|
|
1990
|
+
// For 'wide', media-text blocks are typically inside constrained groups (which use 'container' class)
|
|
1991
|
+
// So we should use 'w-full' to fill the parent container, not apply another max-width
|
|
1992
|
+
// Only use 'max-w-7xl' for truly standalone wide blocks (rare case)
|
|
1979
1993
|
let alignClass;
|
|
1980
1994
|
if (align === 'full') {
|
|
1981
1995
|
alignClass = 'w-full';
|
|
1982
1996
|
}
|
|
1983
1997
|
else if (align === 'wide') {
|
|
1984
|
-
|
|
1998
|
+
// Default to w-full for wide blocks (they're usually inside constrained containers)
|
|
1999
|
+
// This ensures they fill the parent container which is already boxed
|
|
2000
|
+
alignClass = 'w-full';
|
|
1985
2001
|
}
|
|
1986
2002
|
else {
|
|
1987
2003
|
// Default to contained width (not full width)
|