[ew] Normalize empty block cells in prose2aem for viewport inheritance

Aperta
#1,691 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
backend, testing

Direzione di ricerca

Start with blocks/shared/prose2aem.js and trace how detached block serialization handles empty ProseMirror paragraphs and trailing-break markers. Add regression coverage for empty and whitespace-only cells, preservation of meaningful content and indexing, and serialization after live editor updates. Done means empty cells serialize as <div></div> while populated variants retain their content and inheritance works.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Parent: #1688

Problem

prose2aem leaves empty paragraph elements inside otherwise empty block cells. Site code using zero child elements to recognize an inheritable empty cell consequently treats it as populated.

Affected component: adobe/da-live/blocks/shared/prose2aem.js.

Reproduction and evidence

Create a block table with meaningful content in one viewport group and empty cells in another group intended to inherit that content.

The editor represents an empty cell with an empty ProseMirror paragraph and trailing-break marker. Actual detached serialization leaves:

<div><p></p></div>

AEM-compatible output for the tested empty cells is:

<div></div>

A consumer checking:

return !el.children.length && !el.textContent?.trim();

does not recognize the serialized cell as empty. In viewport-based blocks this can remove inherited text, icons, offers, and background settings.

Running the actual viewport helper on detached serialized clones confirmed that removing three empty paragraph wrappers restores inherited content while preserving the original populated variant. The initial DA response can have correct empty cells and still regress after live editor serialization.

Expected outcome

  • Normalize semantically empty table-cell paragraphs during block serialization so empty cells match AEM output.
  • Handle ProseMirror's trailing-break representation and whitespace-only paragraphs without retaining editor-only markup.
  • Preserve meaningful text, images, links, nested content, and indexing on content that survives serialization.
  • Add regression tests for empty cells and nonempty-cell preservation.
  • Verify behavior after live editor updates, not only initial rendering.

This is distinct from adding row/cell scaffolding to an entirely empty block. Defensive consumer changes are optional and should not substitute for serializer parity.

Source

https://github.com/adobe/da-live/blob/main/blocks/shared/prose2aem.js

Lingua principale
JavaScript
Stelle
36
Fork
78
Merge medio
2g 17h
PR unite (30g)
71

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di adobe/da-live

Tutte le issue di adobe/da-live

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.