@marvalt/wparser 0.1.72 → 0.1.73

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.esm.js CHANGED
@@ -2110,10 +2110,14 @@ function extractTextAlignFromInnerBlocks(block) {
2110
2110
  const innerBlocks = block.innerBlocks || [];
2111
2111
  // First, recursively search for heading or paragraph blocks with textAlign
2112
2112
  // (These take priority over group justifyContent)
2113
+ // Note: heading blocks use 'textAlign', paragraph blocks use 'align'
2113
2114
  for (const innerBlock of innerBlocks) {
2114
2115
  if (innerBlock.name === 'core/heading' || innerBlock.name === 'core/paragraph') {
2115
2116
  const attrs = innerBlock.attributes || {};
2116
- const textAlign = attrs['textAlign'];
2117
+ // Heading blocks use 'textAlign', paragraph blocks use 'align'
2118
+ const textAlign = innerBlock.name === 'core/heading'
2119
+ ? attrs['textAlign']
2120
+ : attrs['align'] || attrs['textAlign']; // Check both for paragraph (fallback)
2117
2121
  if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
2118
2122
  return textAlign;
2119
2123
  }
@@ -2124,6 +2128,7 @@ function extractTextAlignFromInnerBlocks(block) {
2124
2128
  return nestedAlign;
2125
2129
  }
2126
2130
  // Only check group blocks if no heading/paragraph alignment found
2131
+ // Recursively search group blocks for justifyContent
2127
2132
  for (const innerBlock of innerBlocks) {
2128
2133
  if (innerBlock.name === 'core/group') {
2129
2134
  const attrs = innerBlock.attributes || {};
@@ -2135,6 +2140,10 @@ function extractTextAlignFromInnerBlocks(block) {
2135
2140
  return 'center';
2136
2141
  if (justifyContent === 'right')
2137
2142
  return 'right';
2143
+ // Also recursively check nested blocks within the group
2144
+ const nestedAlign = extractTextAlignFromInnerBlocks(innerBlock);
2145
+ if (nestedAlign)
2146
+ return nestedAlign;
2138
2147
  }
2139
2148
  }
2140
2149
  return null;