@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.esm.js
CHANGED
|
@@ -1888,16 +1888,28 @@ 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' } : {};
|
|
1900
|
-
return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-
|
|
1912
|
+
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 }));
|
|
1901
1913
|
};
|
|
1902
1914
|
const Cover = ({ block, children }) => {
|
|
1903
1915
|
const attrs = block.attributes || {};
|
|
@@ -1967,19 +1979,23 @@ 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', media-text blocks are typically inside constrained groups (which use 'container' class)
|
|
1989
|
+
// So we should use 'w-full' to fill the parent container, not apply another max-width
|
|
1990
|
+
// Only use 'max-w-7xl' for truly standalone wide blocks (rare case)
|
|
1977
1991
|
let alignClass;
|
|
1978
1992
|
if (align === 'full') {
|
|
1979
1993
|
alignClass = 'w-full';
|
|
1980
1994
|
}
|
|
1981
1995
|
else if (align === 'wide') {
|
|
1982
|
-
|
|
1996
|
+
// Default to w-full for wide blocks (they're usually inside constrained containers)
|
|
1997
|
+
// This ensures they fill the parent container which is already boxed
|
|
1998
|
+
alignClass = 'w-full';
|
|
1983
1999
|
}
|
|
1984
2000
|
else {
|
|
1985
2001
|
// Default to contained width (not full width)
|