Skip to content

Commit c198b67

Browse files
committed
Retaken development. Changed architecture for library
1 parent 4c7292e commit c198b67

57 files changed

Lines changed: 2189 additions & 1225 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.41.5"
3+
}

.gitignore

Lines changed: 86 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,86 @@
1-
# Miscellaneous
2-
*.class
3-
*.log
4-
*.pyc
5-
*.swp
6-
.DS_Store
7-
.atom/
8-
.buildlog/
9-
.history
10-
.svn/
11-
.fvn/
12-
13-
# IntelliJ related
14-
*.iml
15-
*.ipr
16-
*.iws
17-
.idea/
18-
19-
# The .vscode folder contains launch configuration and tasks you configure in
20-
# VS Code which you may wish to be included in version control, so this line
21-
# is commented out by default.
22-
#.vscode/
23-
24-
# Flutter/Dart/Pub related
25-
**/doc/api/
26-
.dart_tool/
27-
.flutter-plugins
28-
.flutter-plugins-dependencies
29-
.packages
30-
.pub-cache/
31-
.pub/
32-
build/
33-
34-
# Android related
35-
**/android/**/gradle-wrapper.jar
36-
**/android/.gradle
37-
**/android/captures/
38-
**/android/gradlew
39-
**/android/gradlew.bat
40-
**/android/local.properties
41-
**/android/**/GeneratedPluginRegistrant.java
42-
43-
# iOS/XCode related
44-
**/ios/**/*.mode1v3
45-
**/ios/**/*.mode2v3
46-
**/ios/**/*.moved-aside
47-
**/ios/**/*.pbxuser
48-
**/ios/**/*.perspectivev3
49-
**/ios/**/*sync/
50-
**/ios/**/.sconsign.dblite
51-
**/ios/**/.tags*
52-
**/ios/**/.vagrant/
53-
**/ios/**/DerivedData/
54-
**/ios/**/Icon?
55-
**/ios/**/Pods/
56-
**/ios/**/.symlinks/
57-
**/ios/**/profile
58-
**/ios/**/xcuserdata
59-
**/ios/.generated/
60-
**/ios/Flutter/App.framework
61-
**/ios/Flutter/Flutter.framework
62-
**/ios/Flutter/Flutter.podspec
63-
**/ios/Flutter/Generated.xcconfig
64-
**/ios/Flutter/app.flx
65-
**/ios/Flutter/app.zip
66-
**/ios/Flutter/flutter_assets/
67-
**/ios/Flutter/flutter_export_environment.sh
68-
**/ios/ServiceDefinitions.json
69-
**/ios/Runner/GeneratedPluginRegistrant.*
70-
71-
# Exceptions to above rules.
72-
!**/ios/**/default.mode1v3
73-
!**/ios/**/default.mode2v3
74-
!**/ios/**/default.pbxuser
75-
!**/ios/**/default.perspectivev3
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
.fvn/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
build/
33+
34+
# Android related
35+
**/android/**/gradle-wrapper.jar
36+
**/android/.gradle
37+
**/android/captures/
38+
**/android/gradlew
39+
**/android/gradlew.bat
40+
**/android/local.properties
41+
**/android/**/GeneratedPluginRegistrant.java
42+
43+
# iOS/XCode related
44+
**/ios/**/*.mode1v3
45+
**/ios/**/*.mode2v3
46+
**/ios/**/*.moved-aside
47+
**/ios/**/*.pbxuser
48+
**/ios/**/*.perspectivev3
49+
**/ios/**/*sync/
50+
**/ios/**/.sconsign.dblite
51+
**/ios/**/.tags*
52+
**/ios/**/.vagrant/
53+
**/ios/**/DerivedData/
54+
**/ios/**/Icon?
55+
**/ios/**/Pods/
56+
**/ios/**/.symlinks/
57+
**/ios/**/profile
58+
**/ios/**/xcuserdata
59+
**/ios/.generated/
60+
**/ios/Flutter/App.framework
61+
**/ios/Flutter/Flutter.framework
62+
**/ios/Flutter/Flutter.podspec
63+
**/ios/Flutter/Generated.xcconfig
64+
**/ios/Flutter/app.flx
65+
**/ios/Flutter/app.zip
66+
**/ios/Flutter/flutter_assets/
67+
**/ios/Flutter/flutter_export_environment.sh
68+
**/ios/ServiceDefinitions.json
69+
**/ios/Runner/GeneratedPluginRegistrant.*
70+
71+
# Exceptions to above rules.
72+
!**/ios/**/default.mode1v3
73+
!**/ios/**/default.mode2v3
74+
!**/ios/**/default.pbxuser
75+
!**/ios/**/default.perspectivev3
76+
77+
# Claude related
78+
**/claude/**/claude-*.log
79+
**/.claude/
80+
CLAUDE.local.md
81+
CLAUDE.md
82+
83+
# FVM Version Cache
84+
.fvm/
85+
86+
.vscode/

CHANGELOG.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
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+
179
## [0.0.5] - Links support
280
* Now you may add links in the editor. Just set the name and the url to set.
381
NOTE: Right now is a basic implementation. I'll make it adhoc to EditorJS standard later

0 commit comments

Comments
 (0)