@marvalt/wparser 0.1.42 → 0.1.43
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
CHANGED
|
@@ -2152,16 +2152,21 @@ function extractTextColor(block, context) {
|
|
|
2152
2152
|
if (colorMatch && colorMatch[1]) {
|
|
2153
2153
|
wpColorName = colorMatch[1];
|
|
2154
2154
|
}
|
|
2155
|
-
//
|
|
2156
|
-
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development'
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2155
|
+
// Enhanced debug logging
|
|
2156
|
+
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development') {
|
|
2157
|
+
if (!wpColorName) {
|
|
2158
|
+
const hasColorClass = className.includes('-color');
|
|
2159
|
+
if (hasColorClass && context.colorMapper) {
|
|
2160
|
+
console.log('🔍 extractTextColor - Found color class in className but no match:', {
|
|
2161
|
+
blockName: block.name,
|
|
2162
|
+
className: className,
|
|
2163
|
+
colorClasses: className.split(' ').filter(c => c.includes('-color')),
|
|
2164
|
+
allAttrs: Object.keys(attrs),
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
else {
|
|
2169
|
+
console.log('✅ extractTextColor - Found color in className:', wpColorName);
|
|
2165
2170
|
}
|
|
2166
2171
|
}
|
|
2167
2172
|
}
|
|
@@ -2335,6 +2340,9 @@ const Paragraph = ({ block, context }) => {
|
|
|
2335
2340
|
const attrs = block.attributes || {};
|
|
2336
2341
|
const textAlign = getTextAlignClasses(attrs['align']);
|
|
2337
2342
|
const spacing = getSpacing(context.spacingConfig || context.registry.spacingConfig, 'paragraph', 'my-6');
|
|
2343
|
+
// Extract text color if specified
|
|
2344
|
+
const textColor = extractTextColor(block, context);
|
|
2345
|
+
const textColorClass = textColor || '';
|
|
2338
2346
|
// Check if innerHTML contains HTML elements (like links, strong, em, etc.)
|
|
2339
2347
|
const hasHTML = block.innerHTML && /<[a-z][\s\S]*>/i.test(block.innerHTML);
|
|
2340
2348
|
// Check if content contains shortcodes (check both HTML and text content)
|
|
@@ -2370,17 +2378,17 @@ const Paragraph = ({ block, context }) => {
|
|
|
2370
2378
|
const hasBlockLevelContent = React.Children.toArray(parts).some((part) => isBlockLevelElement(part));
|
|
2371
2379
|
if (hasBlockLevelContent) {
|
|
2372
2380
|
// Render block-level content without <p> wrapper, but add spacing wrapper
|
|
2373
|
-
return jsxRuntimeExports.jsx("div", { className: spacing, children: parts });
|
|
2381
|
+
return jsxRuntimeExports.jsx("div", { className: buildClassName(spacing, textColorClass), children: parts });
|
|
2374
2382
|
}
|
|
2375
2383
|
// Render shortcode parts inside paragraph (shortcodes are processed as React components)
|
|
2376
|
-
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign), children: parts });
|
|
2384
|
+
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign, textColorClass), children: parts });
|
|
2377
2385
|
}
|
|
2378
2386
|
// If innerHTML contains HTML elements but no shortcodes, render it directly (preserves links, formatting, etc.)
|
|
2379
2387
|
if (hasHTML && block.innerHTML) {
|
|
2380
|
-
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign), dangerouslySetInnerHTML: { __html: htmlContent } });
|
|
2388
|
+
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign, textColorClass), dangerouslySetInnerHTML: { __html: htmlContent } });
|
|
2381
2389
|
}
|
|
2382
2390
|
// No HTML and no shortcodes, just render plain text content
|
|
2383
|
-
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign), children: textContent });
|
|
2391
|
+
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign, textColorClass), children: textContent });
|
|
2384
2392
|
};
|
|
2385
2393
|
const Heading = ({ block, children, context }) => {
|
|
2386
2394
|
const attrs = block.attributes || {};
|