Viewer completeness read-only block types#20
Conversation
There was a problem hiding this comment.
Pull request overview
Adds viewer-only support for additional EditorJS block types and consolidates HTML styling/sanitization so the Flutter viewer renders more of the EditorJS ecosystem consistently.
Changes:
- Added viewer-only blocks:
embed,linkTool,attaches,raw(entities, mappers, renderers, registry wiring, exports) - Introduced
HtmlStyleBuilderto centralizeflutter_htmlstyle-map creation and propagatedefaultFont - Expanded HTML sanitization usage (notably in quote/list) and bumped package version to
0.2.1
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pubspec.yaml | Bumps package version to 0.2.1 |
| lib/src/presentation/utils/html_style_builder.dart | New shared builder for flutter_html style maps (fonts + cssTags) |
| lib/src/presentation/registry/block_renderer_registry.dart | Registers new renderers for the viewer-only block types |
| lib/src/presentation/blocks/raw/raw_renderer.dart | Renders sanitized raw HTML via flutter_html |
| lib/src/presentation/blocks/quote/quote_renderer.dart | Uses sanitizer + shared HTML styles (adds alignment handling in style map) |
| lib/src/presentation/blocks/paragraph/paragraph_renderer.dart | Switches to shared HTML style builder |
| lib/src/presentation/blocks/list/list_renderer.dart | Sanitizes list item HTML and switches to shared HTML style builder |
| lib/src/presentation/blocks/link_tool/link_tool_renderer.dart | New link preview card renderer opening URLs externally |
| lib/src/presentation/blocks/image/image_renderer.dart | Applies defaultFont to image captions |
| lib/src/presentation/blocks/embed/embed_renderer.dart | New embed card renderer opening source URL externally |
| lib/src/presentation/blocks/attaches/attaches_renderer.dart | New attachment card renderer opening download URL externally |
| lib/src/domain/entities/blocks/raw_block.dart | New Raw block entity |
| lib/src/domain/entities/blocks/link_tool_block.dart | New LinkTool block entity + meta model |
| lib/src/domain/entities/blocks/embed_block.dart | New Embed block entity |
| lib/src/domain/entities/blocks/attaches_block.dart | New Attaches block entity |
| lib/src/data/registry/block_type_registry.dart | Registers new block mappers for JSON → entity parsing |
| lib/src/data/mappers/raw_mapper.dart | Raw block JSON mapper |
| lib/src/data/mappers/link_tool_mapper.dart | LinkTool block JSON mapper |
| lib/src/data/mappers/embed_mapper.dart | Embed block JSON mapper |
| lib/src/data/mappers/attaches_mapper.dart | Attaches block JSON mapper |
| lib/editorjs_flutter.dart | Exports new public block entities |
| CHANGELOG.md | Adds 0.2.1 release notes describing new viewer-only blocks and renderer improvements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@RZEROSTERN I've opened a new pull request, #21, to work on those changes. Once the pull request is ready, I'll request review from you. |
…strict to http/https, check canLaunchUrl Co-authored-by: RZEROSTERN <3065243+RZEROSTERN@users.noreply.github.com> Agent-Logs-Url: https://github.com/RZEROSTERN/editorjs-flutter/sessions/97759922-db09-4059-af45-b959591f6f85
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix unsafe URL launch in AttachesRenderer
|
@RZEROSTERN I've opened a new pull request, #22, to work on those changes. Once the pull request is ready, I'll request review from you. |
Fix unsafe URL launch in LinkToolRenderer
Phase 2 + Viewer Completeness: new block types, sanitization & rendering
Type of change
Summary
Viewer completeness — read-only block types (0.2.1)
embed,linkTool,attaches,rawHtmlStyleBuildershared utility — removes duplicate_buildStyleMap/_parseColorhelpers from every renderer and propagatesdefaultFonttoflutter_htmlbody styleHtmlSanitizer.sanitize()toQuoteRendererandListRendererImageRenderercaption now respectsstyleConfig.defaultFont0.2.0→0.2.1Breaking changes
ListBlock.itemstype changed fromList<String>toList<ListItem>. Any code constructing aListBlockdirectly must update toListItem(content: 'text')instead of plain strings.Migration notes
New public API
QuoteBlock/QuoteAlignmentCodeBlockChecklistBlock/ChecklistItemTableBlockWarningBlockListItemEmbedBlockLinkToolBlock/LinkToolMetaAttachesBlockRawBlockTest plan
fvm flutter analyzepasses with no issues ✅alignmentfieldwithHeadings: truerenders first row boldembedblock opens source URL externally on taplinkToolblock shows thumbnail + title + description + URL; opens on tapattachesblock shows correct icon per extension, formatted size, opens on taprawblock sanitizes HTML before rendering (no<script>oron*attributes pass through)defaultFontfromStyleConfigapplies insideflutter_htmlrendered contentgetContent()serialises all block types back to valid EditorJS JSON