Skip to content

Commit 4706807

Browse files
rjvelazcoclaude
andauthored
fix(editor): render list markers in block editor web component (#36249)
## Block Editor: list markers not rendering in the web component Bullet and ordered lists rendered **without markers** (no bullets/numbers) in the new Block Editor when it runs as the `dotcms-block-editor` web component. Follow-up to #36235, found during the #35980 bug hunt. ### Root cause The editor was relying on the host page's Tailwind `prose` to render list markers — a fragile dependency for a web component meant to drop into arbitrary host pages. Two host-cascade effects defeated it: 1. **Tailwind preflight** resets `ol, ul, menu { list-style: none }` in `@layer base`. In the web-component build's layer order this **beats `prose`**, so `<ul>`/`<ol>` lost their markers. 2. The admin **JSP** additionally ships an unlayered `li { list-style: none }` set *directly on the `<li>`*, overriding the `list-style-type` the `<li>` would otherwise inherit from its list parent. On top of that, prose colors `li::marker` a light gray. ### Proposed Changes Add **self-contained, unlayered** list CSS to `editor.component.css` so markers render regardless of the host's Tailwind/prose setup (same pattern the file already uses for tables/code/figures): - `ul → disc`, `ol → decimal`, with `padding-left` so the markers are visible (`list-style-position: outside` paints them in the indent). - Nested-marker cycling: `disc → circle → square`. - `li { list-style: inherit }` — re-derives the marker from the list parent, defeating the JSP's `li { list-style: none }`. `.tiptap li` (0,2,1) out-specifies JSP's `li` (0,0,1). - `li::marker { color: currentColor }` — markers match the editor text instead of prose's gray. - Tight `li` / `li > p` spacing so markers align with the first line of text. ### Checklist - [ ] Tests — N/A (no specs in `new-block-editor`; verified via build + manual) - [ ] Translations — N/A (CSS only) - [x] Security Implications Contemplated — none (presentation-only) ### Additional Info - Scope: editor content lists (`.tiptap ul/ol/li`); unlayered so it wins over layered Tailwind resets in **both** the web-component (`dotcms-block-editor`) and Angular (`dot-block-editor`) hosts. - Production build passes (`nx run dotcms-block-editor:build --configuration=production`); the bundle-budget line is a pre-existing warning unrelated to this change. ### Video https://github.com/user-attachments/assets/31387ee8-5d23-4041-b79e-3f4c92c3ad42 Related to #35980 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e0fbb1d commit 4706807

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

core-web/libs/new-block-editor/src/lib/editor/editor.component.css

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,63 @@
133133
margin-top: 2.5rem;
134134
}
135135

136+
/* ─── Lists ─────────────────────────────────────────────── */
137+
/* Self-contained list rendering. We do NOT rely on the host page's Tailwind
138+
Typography (`prose`) for markers: Tailwind's preflight resets
139+
`ol, ul, menu { list-style: none }` in `@layer base`, and depending on the
140+
consuming app's layer order that can beat `prose` (it does in the
141+
`dotcms-block-editor` web-component build, where lists rendered with no
142+
bullets/numbers). These rules are unlayered component CSS, so they win over
143+
any layered Tailwind reset regardless of host. `padding-left` is required for
144+
the markers to be visible (`list-style-position: outside` paints them in the
145+
indent); it also out-specifies the host-style `revert-layer` defense (0,1,1),
146+
which would otherwise strip the list's padding and clip the markers. */
147+
:host ::ng-deep .tiptap ul,
148+
:host ::ng-deep .tiptap ol {
149+
padding-left: 1.625rem;
150+
margin: 0;
151+
}
152+
153+
:host ::ng-deep .tiptap ul {
154+
list-style: disc;
155+
}
156+
157+
:host ::ng-deep .tiptap ol {
158+
list-style: decimal;
159+
}
160+
161+
/* Nested markers cycle so depth stays legible */
162+
:host ::ng-deep .tiptap ul ul {
163+
list-style: circle;
164+
}
165+
166+
:host ::ng-deep .tiptap ul ul ul {
167+
list-style: square;
168+
}
169+
170+
/* `list-style: inherit` is load-bearing: the admin JSP ships an unlayered
171+
`li { list-style: none }` that sets the property *directly on the <li>*,
172+
overriding the value `list-style-type` would otherwise inherit from the
173+
<ul>/<ol> above. Forcing the li to inherit re-derives the correct marker
174+
(disc / decimal / circle / square) from its list parent. `.tiptap li`
175+
(0,2,1) out-specifies the JSP's `li` (0,0,1). */
176+
:host ::ng-deep .tiptap li {
177+
margin: 0.25rem 0;
178+
list-style: inherit;
179+
}
180+
181+
/* Markers default to Tailwind prose's light-gray bullet/counter color; match
182+
them to the editor's text color so they read as part of the content. */
183+
:host ::ng-deep .tiptap li::marker {
184+
color: currentColor;
185+
}
186+
187+
/* TipTap wraps list-item content in a <p>; collapse its prose margins so the
188+
marker stays vertically aligned with the first line of text. */
189+
:host ::ng-deep .tiptap li > p {
190+
margin: 0;
191+
}
192+
136193
/* ─── Figures / Images ──────────────────────────────────── */
137194
:host ::ng-deep .ProseMirror figure {
138195
display: block;

0 commit comments

Comments
 (0)