@webikon/webentor-core 0.10.1 → 0.12.0
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/CHANGELOG.md +18 -0
- package/core-js/blocks-filters/responsive-settings/AGENTS.md +3 -1
- package/core-js/blocks-filters/responsive-settings/index.tsx +75 -1
- package/core-js/blocks-filters/responsive-settings/utils.ts +97 -18
- package/package.json +1 -1
- package/public/build/assets/{coreEditorJs-DYd3ZopL.js → coreEditorJs-BJHc-PKW.js} +35 -35
- package/public/build/assets/{coreEditorJs-DYd3ZopL.js.map → coreEditorJs-BJHc-PKW.js.map} +1 -1
- package/public/build/manifest.json +1 -1
- package/resources/blocks/l-section/l-section.block.tsx +24 -2
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
CustomImageSizesPanel,
|
|
21
21
|
WebentorBlockAppender,
|
|
22
22
|
} from '@webentorCore/blocks-components';
|
|
23
|
+
import { collectClassTokensFromAttributes } from '@webentorCore/blocks-filters/responsive-settings/utils';
|
|
23
24
|
import { useBlockParent } from '@webentorCore/blocks-utils/_use-block-parent';
|
|
24
25
|
|
|
25
26
|
import block from './block.json';
|
|
@@ -50,6 +51,27 @@ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
|
|
|
50
51
|
const blockProps = useBlockProps();
|
|
51
52
|
const parentBlockProps = useBlockParent();
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Split responsive classes between wrapper and inner container, mirroring
|
|
56
|
+
* the PHP split in data.php:
|
|
57
|
+
* webentor/block_classes → wrapper (spacing, sizing, border, colors, …)
|
|
58
|
+
* webentor/block_custom_classes → container (layout.display, flexbox, grid)
|
|
59
|
+
*
|
|
60
|
+
* registerBlockExtension puts ALL responsive classes on blockProps.className
|
|
61
|
+
* (the wrapper). We collect the container-bound tokens directly from the
|
|
62
|
+
* attribute values and move them to the inner div.
|
|
63
|
+
*/
|
|
64
|
+
const containerClassTokens = collectClassTokensFromAttributes(attributes, [
|
|
65
|
+
'layout',
|
|
66
|
+
'flexbox',
|
|
67
|
+
'grid',
|
|
68
|
+
]);
|
|
69
|
+
const wrapperClassName = (blockProps.className ?? '')
|
|
70
|
+
.split(/\s+/)
|
|
71
|
+
.filter((c: string) => c && !containerClassTokens.has(c))
|
|
72
|
+
.join(' ');
|
|
73
|
+
const containerResponsiveClasses = [...containerClassTokens].join(' ');
|
|
74
|
+
|
|
53
75
|
/**
|
|
54
76
|
* Filter allowed blocks used in webentor/l-section inner block
|
|
55
77
|
*/
|
|
@@ -265,10 +287,10 @@ const BlockEdit: React.FC<BlockEditProps<AttributesType>> = (props) => {
|
|
|
265
287
|
{
|
|
266
288
|
applyFilters(
|
|
267
289
|
'webentor.core.l-section.output',
|
|
268
|
-
<div {...blockProps} className={`w-section ${
|
|
290
|
+
<div {...blockProps} className={`w-section ${wrapperClassName}`}>
|
|
269
291
|
<div
|
|
270
292
|
{...innerBlocksProps}
|
|
271
|
-
className={`${innerBlocksProps.className} container wbtr:relative wbtr:z-[2] wbtr:flex wbtr:flex-col`}
|
|
293
|
+
className={`${innerBlocksProps.className} container wbtr:relative wbtr:z-[2] wbtr:flex wbtr:flex-col ${containerResponsiveClasses}`}
|
|
272
294
|
>
|
|
273
295
|
{children}
|
|
274
296
|
|