JSON serialization of markup only slots is broken

Created on 11 September 2024, 4 months ago
Updated 12 September 2024, 4 months ago

Problem

Atm when data is output as slot, the element name may be omitted instead of being simply drupal-markup:

This has two problems:
a) it may be confusing since the element JSON is not recognizable as element JSON without an element name
b) rendering the element on the frontend atm does expect the the custom element name.

So atm the frontend needs to do take care of the default and complicate the code like this:

    <slot name="body">
      <component :is="useDrupalCe().renderCustomElements({
        element: $attrs.body.element ?? 'drupal-markup',
        content: $attrs.body.content,
      })" />
    </slot>

Proposed resolution

Let's add the drupal-markup default custom element name, so the frontend can rely on it and simplify the code as follows:

    <slot name="body">
      <component :is="useDrupalCe().renderCustomElements($attrs.body)" />
    </slot>

API changes

small change in behaviour, so maybe best do it only in v3.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇦🇹Austria fago Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024