diff --git a/docs/guides/divi-attrs.md b/docs/guides/divi-attrs.md index 2f316eb..f6e570e 100644 --- a/docs/guides/divi-attrs.md +++ b/docs/guides/divi-attrs.md @@ -24,7 +24,7 @@ Breakpoints: `desktop`, `tablet`, `phone` (je nach Website auch `tabletWide`, `p gültigen Pfade dieses Moduls auf dieser Website (live aus Divi) und die Kurzform-Felder mit ihrem Pfad. `path_kinds` nennt die Feldart eines Pfads (`text`, `richtext`, `code`, `url`, `image`, `color`, `enum`, `onoff`, `number`, `list`, `icon`), soweit aus den Divi-Metadaten ableitbar. Bei einem zusammengesetzten - Pfad (mehrere benannte Unterfelder unter einem Pfad, z. B. `buttonOne.innerContent` mit `text` und + Pfad (ein oder mehrere benannte Unterfelder unter einem Pfad, z. B. `buttonOne.innerContent` mit `text` und `linkUrl`) ist der Eintrag stattdessen eine Zuordnung Unterfeld → Feldart (`{"text": "text", "linkUrl": "url"}`), soweit für die einzelnen Unterfelder ableitbar; fehlende Pfade oder Unterfelder gelten als unbekannt, statt eine Feldart zu raten. diff --git a/src/Integrations/Divi/BlockTree/Block.php b/src/Integrations/Divi/BlockTree/Block.php index e7212e2..86d633d 100644 --- a/src/Integrations/Divi/BlockTree/Block.php +++ b/src/Integrations/Divi/BlockTree/Block.php @@ -20,7 +20,7 @@ use stdClass; final class Block extends Container { /** A valid block name: "namespace/block-name" (WordPress' own block name convention). */ - private const NAME_PATTERN = '/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/'; + private const NAME_PATTERN = '/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/D'; /** * @param array $attrs diff --git a/src/Integrations/Divi/BlockTree/NodeIndex.php b/src/Integrations/Divi/BlockTree/NodeIndex.php index f982cad..dd07012 100644 --- a/src/Integrations/Divi/BlockTree/NodeIndex.php +++ b/src/Integrations/Divi/BlockTree/NodeIndex.php @@ -14,7 +14,7 @@ namespace LIT\MCP\Integrations\Divi\BlockTree; */ final class NodeIndex { - public const ID_PATTERN = '/^[srcmgx]\d+(\.[srcmgx]\d+)*$/'; + public const ID_PATTERN = '/^[srcmgx]\d+(\.[srcmgx]\d+)*$/D'; /** @var array */ private array $byId = []; diff --git a/src/Integrations/Divi/BlockTree/Serializer.php b/src/Integrations/Divi/BlockTree/Serializer.php index 76d55ee..f1493da 100644 --- a/src/Integrations/Divi/BlockTree/Serializer.php +++ b/src/Integrations/Divi/BlockTree/Serializer.php @@ -9,7 +9,7 @@ namespace LIT\MCP\Integrations\Divi\BlockTree; * delimiters; changed or new blocks get delimiters generated exactly like WordPress' * get_comment_delimited_block_content() / serialize_block_attributes() do, which also * yields the escaping Divi expects inside $variable(…)$ payloads: json_encode()'s own - * \" (an escaped quote inside a JSON string) is replaced by ", see ESCAPES below. + * \" (an escaped quote inside a JSON string) is replaced by \u0022, see ESCAPES below. */ final class Serializer { diff --git a/src/Integrations/Divi/Schema/AttrPathIndex.php b/src/Integrations/Divi/Schema/AttrPathIndex.php index 573a1c7..a88620b 100644 --- a/src/Integrations/Divi/Schema/AttrPathIndex.php +++ b/src/Integrations/Divi/Schema/AttrPathIndex.php @@ -69,7 +69,10 @@ final class AttrPathIndex * type still tells them apart reliably. Only used for composite (subName-bearing) * candidates; a plain path keeps trusting its field component alone (COMPONENT_KINDS), * so an already more specific kind there (richtext, code, …) is never downgraded to the - * generic "text" dynamicContent commonly names for both. + * generic "text" dynamicContent commonly names for both. number-advanced (e.g. border + * radius) holds an object of corner values and therefore stays unknown. A path that has + * both a plain field and named sub-fields keeps only the sub-field map (the plain field + * then counts as unknown). */ private const DYNAMIC_CONTENT_KINDS = [ 'text' => 'text', @@ -77,7 +80,6 @@ final class AttrPathIndex 'image' => 'image', 'color' => 'color', 'number' => 'number', - 'number-advanced' => 'number', ]; private const ATTR_NAME_PATTERN = '/^[A-Za-z0-9]+(\.[A-Za-z0-9]+)+$/'; diff --git a/src/Integrations/Divi/Schema/DiviCatalogAbility.php b/src/Integrations/Divi/Schema/DiviCatalogAbility.php index fe6e640..70945d1 100644 --- a/src/Integrations/Divi/Schema/DiviCatalogAbility.php +++ b/src/Integrations/Divi/Schema/DiviCatalogAbility.php @@ -84,8 +84,9 @@ final class DiviCatalogAbility implements Ability 'type' => 'object', 'description' => 'Bekannter Attributpfad => Feldart (text, richtext, code, url, ' . 'image, color, enum, onoff, number, list, icon), soweit aus den Divi-Metadaten ' - . 'ableitbar. Bei einem zusammengesetzten Pfad (mehrere benannte Unterfelder unter ' - . 'einem Pfad, z. B. buttonOne.innerContent mit "text" und "linkUrl") ist der Wert ' + . 'ableitbar. Bei einem zusammengesetzten Pfad (ein oder mehrere benannte ' + . 'Unterfelder unter einem Pfad, z. B. buttonOne.innerContent mit "text" und ' + . '"linkUrl") ist der Wert ' . 'stattdessen eine Zuordnung Unterfeld => Feldart, soweit für die einzelnen ' . 'Unterfelder ableitbar. Fehlende Pfade oder Unterfelder gelten als unbekannt.', ], diff --git a/tests/Unit/Integrations/Divi/BlockTree/BlockTest.php b/tests/Unit/Integrations/Divi/BlockTree/BlockTest.php index ba1b31a..5b69e35 100644 --- a/tests/Unit/Integrations/Divi/BlockTree/BlockTest.php +++ b/tests/Unit/Integrations/Divi/BlockTree/BlockTest.php @@ -19,6 +19,7 @@ final class BlockTest extends TestCase return [ 'no namespace' => ['button'], 'trailing markup injection' => ['divi/x -->