@webikon/webentor-core 0.10.1 → 0.11.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.
@@ -73,7 +73,7 @@
73
73
  ]
74
74
  },
75
75
  "resources/scripts/editor.ts": {
76
- "file": "assets/coreEditorJs-DYd3ZopL.js",
76
+ "file": "assets/coreEditorJs-BJHc-PKW.js",
77
77
  "name": "coreEditorJs",
78
78
  "src": "resources/scripts/editor.ts",
79
79
  "isEntry": true,
@@ -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 ${blockProps.className}`}>
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