|
| 1 | +## [0.1.0] - 2026-03-25 — Clean Architecture refactor (breaking) |
| 2 | + |
| 3 | +This release is a full architectural rewrite. The public API has changed. |
| 4 | +See the migration notes below. |
| 5 | + |
| 6 | +### Breaking changes |
| 7 | +* `EditorJSView` parameter renamed: `editorJSData` → `jsonData`, `styles` → `config` (accepts `EditorConfig`). |
| 8 | +* `EditorJSEditor` now requires an `EditorController` passed via `controller:`. |
| 9 | +* Old `src/model/` and `src/widgets/` packages removed entirely. |
| 10 | + |
| 11 | +### Architecture |
| 12 | +* Adopted Clean Architecture with three strict layers: `domain`, `data`, `presentation`. Dependencies flow inward only; `domain` has zero Flutter imports. |
| 13 | +* Applied SOLID principles throughout: one class per block type (SRP), block registry for extensibility without modifying core files (OCP), all renderers/editors implement typed abstract bases (LSP/DIP). |
| 14 | +* New block type registry pattern: register custom block types at runtime via `BlockTypeRegistry` and `BlockRendererRegistry` without touching any package file. |
| 15 | + |
| 16 | +### New: `EditorController` |
| 17 | +* Replaces the previous `List<Widget>` anti-pattern in the editor. |
| 18 | +* Holds `List<BlockEntity>` as the source of truth. |
| 19 | +* Exposes `getContent()` → EditorJS-compliant JSON string (previously impossible). |
| 20 | +* Zero-arg factory `EditorController()` wires the default serializer automatically. |
| 21 | +* Full block management API: `addBlock`, `insertBlock`, `updateBlock`, `removeBlock`, `moveBlock`, `clear`. |
| 22 | + |
| 23 | +### New: domain entities |
| 24 | +* `BlockEntity` — abstract base class for all block types. |
| 25 | +* `BlockDocument` — root document entity with full `toJson()` serialization. |
| 26 | +* `StyleConfig` / `CssTagConfig` — styling configuration entities replacing old JSON-only models. |
| 27 | +* Typed block entities: `HeaderBlock`, `ParagraphBlock`, `ListBlock`, `DelimiterBlock`, `ImageBlock` — each owns only its relevant fields and serializes itself. |
| 28 | + |
| 29 | +### New: data layer |
| 30 | +* `BlockMapper<T>` — abstract interface for deserializing a block type from EditorJS JSON. |
| 31 | +* Five concrete mappers (`HeaderMapper`, `ParagraphMapper`, `ListMapper`, `DelimiterMapper`, `ImageMapper`) with safe, non-throwing parsing. |
| 32 | +* `BlockTypeRegistry` — pre-registered with all built-in mappers; callers call `.register()` for custom blocks. |
| 33 | +* `JsonDocumentSource` — implements `DocumentRepository`; unknown block types are silently skipped (never throws on unrecognized data). |
| 34 | + |
| 35 | +### New: presentation layer |
| 36 | +* `BlockRenderer<T>` / `BlockEditor<T>` — abstract base widgets for custom block authors. |
| 37 | +* `BlockRendererRegistry` — maps type strings to renderer/editor builder functions. |
| 38 | +* `EditorConfig` — single configuration object accepted by both `EditorJSView` and `EditorJSEditor`. |
| 39 | +* Five renderer widgets: fully stateless, receive an immutable entity. |
| 40 | +* Five editor widgets: push updates upward via `ValueChanged<T>` callback; no direct parent coupling. |
| 41 | +* `EditorJSToolbar` — decoupled from editor widget; communicates exclusively through `EditorController`. |
| 42 | +* Image renderer now respects `caption`, `withBorder`, `stretched`, and `withBackground` fields. |
| 43 | +* Image load errors show a placeholder widget instead of crashing. |
| 44 | + |
| 45 | +### Dependency upgrades |
| 46 | +* Dart SDK constraint: `>=2.14.0 <3.0.0` → `>=3.0.0 <4.0.0` |
| 47 | +* Flutter constraint: `>=2.10.0` → `>=3.10.0` |
| 48 | +* `flutter_html`: `^2.2.1` → `^3.0.0-beta.2` (API breaking: `Style.padding` now uses `HtmlPaddings`) |
| 49 | +* `image_picker`: `^0.8.6` → `^1.0.0` |
| 50 | +* `url_launcher`: `^6.1.6` → `^6.2.0` |
| 51 | + |
| 52 | +### Bug fixes |
| 53 | +* Replaced deprecated `launch()` with `launchUrl(Uri.parse(...))` in toolbar. |
| 54 | +* Replaced deprecated `MaterialStateProperty` with `WidgetStateProperty`. |
| 55 | +* Fixed `stretched` field never being assigned in the old `EditorJSBlockData.fromJson`. |
| 56 | +* Removed duplicate `toolbar.dart` import in `editor.dart`. |
| 57 | +* Fixed `MyHomePage` constructor to use `Key?` and `required this.title` (null safety). |
| 58 | +* Removed dead toolbar buttons (quote, list) that previously rendered with no functionality. |
| 59 | + |
| 60 | +### Migration guide |
| 61 | +```dart |
| 62 | +// Before |
| 63 | +EditorJSView(editorJSData: json, styles: stylesJson) |
| 64 | +
|
| 65 | +// After |
| 66 | +EditorJSView(jsonData: json, config: EditorConfig(styleConfig: styleConfig)) |
| 67 | +
|
| 68 | +// Before — editor had no save mechanism |
| 69 | +EditorJSEditor() |
| 70 | +
|
| 71 | +// After — create a controller, pass it in, call getContent() to export |
| 72 | +final controller = EditorController(); |
| 73 | +EditorJSEditor(controller: controller) |
| 74 | +final json = controller.getContent(); |
| 75 | +``` |
| 76 | + |
| 77 | +--- |
| 78 | + |
1 | 79 | ## [0.0.5] - Links support |
2 | 80 | * Now you may add links in the editor. Just set the name and the url to set. |
3 | 81 | NOTE: Right now is a basic implementation. I'll make it adhoc to EditorJS standard later |
|
0 commit comments