Trigger an error if a paragraph misses important classes / markup

Created on 22 February 2022, over 2 years ago
Updated 18 October 2023, about 1 year ago

Problem/Motivation

In #3265673: Nested (Tab & Content) NON-LP paragraphs not saved in 2.x the issue was, that a designer had overwritten a paragraphs twig file and removed the wrapper div containing the attributes, which are required for layout_paragraphs (2.x - as in 1.x it worked).

Required attributes on the paragraph wrapper div are:

  • data-uuid
  • data-type
  • data-id (if saved)
  • classes like "js-lpb-component paragraph"

As a result, the layout paragraphs 2 functionality was broken, for example:
The controls were missing (no edit possible, etc.)
The paragraph was never saved

Which lead to endless hours searching for the reason why these attributes are missing and the last thing I checked, was a template overwrite... -.-

So it would be nice, if layout paragraphs could trigger an error to the console or wherever to inform the developer that the structure is broken and why.

I'm not yet sure how it's best, but I guess this might also happen to others, where a designer doesn't know about the relevance for layout_paragraphs (while output might be okay for him in the frontend).

Steps to reproduce

Proposed resolution

Add a validation in JavaScript which triggers an error if a paragraph added doesn't contain the expected & required attributes.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇵🇹Portugal lolgm

    I have the same problem.

    After investigating a little, I noticed that when the validation messages for the mandatory fields of the form are shown, all open dialogs (level 1 and level 2) are replaced with the form that gave an error, which means that all open dialogs have the same content.

    It seems to me that this problem is happening due to some problem updating the dialogs/forms with AJAX.
    However, I was unable to identify the origin of this problem.

Production build 0.71.5 2024