feat(block-editor): image text wrap and alignment controls#35209
feat(block-editor): image text wrap and alignment controls#35209
Conversation
…mn rules Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add textWrap (left/right float) and textAlign attributes to the dotImage node - Bubble menu now has wrap-left/wrap-right buttons and align left/center/right buttons that are mutually exclusive — selecting one clears the other - Active button state highlighted with blue-100 background via ::ng-deep - Image node wrapped in <figure> (replaces <div>) in editor, VTL template, and both SDKs - Float layout sets width: 50% so surrounding text wraps around the image - Updated React and Angular SDK image block components to render textWrap/textAlign styles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @fmontes's task in 4m 52s —— View job ReviewA few real issues worth addressing: 1. Bubble menu active state breaks on undo/redo
2. Duplicate toggle logic between command and component
3. The PR description says " 4. Deferred per the review thread, but still a genuine rendering defect: when 5. Should be 6. Redundant
Minor / not blocking
|
There was a problem hiding this comment.
Pull request overview
Adds image text-wrap and alignment controls to the Block Editor image block and propagates the new attributes through server (VTL) rendering and the React/Angular SDK renderers, while also moving the output wrapper toward a semantic <figure> element.
Changes:
- Added
textWrap/textAlignattributes and bubble-menu controls to toggle wrap-left/right and align-left/center/right (mutually exclusive). - Updated VTL + React SDK + Angular SDK image renderers to wrap images in
<figure>and apply wrap/align styling. - Updated editor CSS to support floated wrappers and new active-state button styling; added block-editor library guidance doc.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| dotCMS/src/main/webapp/WEB-INF/velocity/static/storyblock/dotImage.vtl | Switches wrapper to <figure> and applies inline wrap/align styles in server rendering. |
| core-web/libs/sdk/react/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Image.tsx | Adds wrap/align support and renders image inside <figure> in the React SDK renderer. |
| core-web/libs/sdk/angular/src/lib/components/dotcms-block-editor-renderer/blocks/image.component.ts | Adds wrap/align support and renders image inside <figure> in the Angular SDK renderer. |
| core-web/libs/block-editor/src/lib/nodes/image-node/image.node.ts | Adds textWrap/textAlign attributes + command and applies wrap/align in the editor node view/serializer. |
| core-web/libs/block-editor/src/lib/elements/dot-bubble-menu/dot-bubble-menu.component.ts | Adds state + handlers to set/clear image wrap/align and keep UI active state in sync with selection. |
| core-web/libs/block-editor/src/lib/elements/dot-bubble-menu/dot-bubble-menu.component.html | Rewires image alignment buttons to image-specific attrs and adds wrap-left/right controls. |
| core-web/libs/block-editor/src/lib/elements/dot-bubble-menu/dot-bubble-menu.component.css | Adds styling for active bubble-menu buttons. |
| core-web/libs/block-editor/src/lib/components/dot-block-editor/dot-block-editor.component.css | Updates image alignment selectors for wrapper-based classes and introduces float wrapper styles. |
| core-web/libs/block-editor/CLAUDE.md | Adds documentation/guidance for block-editor structure and node authoring rules. |
- Use <figure> in renderHTML() to match VTL and SDK output
- Lowercase attribute names (textwrap/textalign) to fix browser round-trip parsing
- Add width: 50% to FLOAT_STYLES so stored HTML matches SDK rendering
- Only add dot-node-{align} class when alignment is explicitly set
- Whitelist textAlign values in VTL to prevent CSS injection
- Toggle align off when re-clicking the active align button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Re: remaining Copilot comments
|
…View HTMLAttributes keys are lowercased by renderHTML (textwrap/textalign), so reading them returned undefined. Use node.attrs directly instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace ngStyle with [style] binding in Angular SDK image component - Use null instead of 'none' sentinel for imageTextWrap signal in bubble menu - Simplify setImageTextWrap toggle logic in image.node.ts - Format dotImage.vtl for readability - Add tests for Angular SDK DotImageBlock component - Add tests for React SDK DotCMSImage component Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rollback Safety Analysis
Result: ✅ Safe To Rollback This PR modifies only frontend/template assets — no database migrations, no Elasticsearch mapping changes, no data transformations, and no REST API contract changes. None of the rollback-unsafe categories apply:
Note on graceful degradation: Content saved with Label added: AI: Safe To Rollback |
video.mp4
Summary
Adds text wrap and alignment controls for the image block in the Block Editor, allowing content authors to float images left/right with text wrapping around them, or align images horizontally.
<figure>element: Replaced<div>wrapper with semantic<figure>across the editor, VTL template, and both React and Angular SDKsImage.tsx) and Angular (image.component.ts) SDK image block components updated to rendertextWrapandtextAlignattributesTest plan
<figure>🤖 Generated with Claude Code