@marvalt/wparser 0.1.65 → 0.1.66
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 +38 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +38 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/blockExtractors.d.ts +4 -1
- package/dist/utils/blockExtractors.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2069,19 +2069,50 @@ function extractTextAlignFromInnerBlocks(block) {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
/**
|
|
2071
2071
|
* Parse contentPosition string into horizontal and vertical alignment
|
|
2072
|
-
*
|
|
2072
|
+
* Supports both formats:
|
|
2073
|
+
* - "horizontal vertical" (e.g., "left bottom", "center center")
|
|
2074
|
+
* - "vertical horizontal" (e.g., "bottom left", "top center")
|
|
2075
|
+
* WordPress typically uses "bottom left" format
|
|
2073
2076
|
*/
|
|
2074
2077
|
function parseContentPosition(contentPosition) {
|
|
2075
2078
|
if (!contentPosition) {
|
|
2076
2079
|
return { horizontal: 'left', vertical: 'center' };
|
|
2077
2080
|
}
|
|
2078
2081
|
const parts = contentPosition.trim().split(/\s+/);
|
|
2079
|
-
const
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2082
|
+
const part1 = parts[0] || '';
|
|
2083
|
+
const part2 = parts[1] || '';
|
|
2084
|
+
let horizontal = 'left';
|
|
2085
|
+
let vertical = 'center';
|
|
2086
|
+
// Try to detect format: if first part is vertical, WordPress format (vertical horizontal)
|
|
2087
|
+
if (part1 === 'top' || part1 === 'bottom') {
|
|
2088
|
+
// WordPress format: "bottom left" -> vertical=bottom, horizontal=left
|
|
2089
|
+
vertical = part1;
|
|
2090
|
+
horizontal = (part2 === 'center' || part2 === 'right' ? part2 : 'left');
|
|
2091
|
+
}
|
|
2092
|
+
else if (part1 === 'left' || part1 === 'right') {
|
|
2093
|
+
// Standard format: "left bottom" -> horizontal=left, vertical=bottom
|
|
2094
|
+
horizontal = part1;
|
|
2095
|
+
vertical = (part2 === 'top' || part2 === 'bottom' ? part2 : 'center');
|
|
2096
|
+
}
|
|
2097
|
+
else if (part1 === 'center') {
|
|
2098
|
+
// First part is center - check second part to determine format
|
|
2099
|
+
if (part2 === 'top' || part2 === 'bottom') {
|
|
2100
|
+
// "center bottom" -> horizontal=center, vertical=bottom
|
|
2101
|
+
horizontal = 'center';
|
|
2102
|
+
vertical = part2;
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
// "center center" or "center left/right" -> both center or horizontal=center
|
|
2106
|
+
horizontal = 'center';
|
|
2107
|
+
vertical = (part2 === 'top' || part2 === 'bottom' ? part2 : 'center');
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
// Unknown format, use defaults
|
|
2112
|
+
horizontal = 'left';
|
|
2113
|
+
vertical = 'center';
|
|
2114
|
+
}
|
|
2115
|
+
return { horizontal, vertical };
|
|
2085
2116
|
}
|
|
2086
2117
|
/**
|
|
2087
2118
|
* Extract video iframe HTML from innerBlocks (finds HTML block with iframe)
|