Skip to content

Commit 2ce140c

Browse files
authored
Merge pull request #27 from RZEROSTERN/chore/publication-readiness
Chore for CI/CD, code coverage and example app
2 parents 5fa1dfe + 22fb72a commit 2ce140c

17 files changed

Lines changed: 4321 additions & 17 deletions

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: subosito/flutter-action@v2
17+
with:
18+
flutter-version: '3.41.5'
19+
channel: stable
20+
21+
- name: Install dependencies
22+
run: flutter pub get
23+
24+
- name: Analyze
25+
run: flutter analyze
26+
27+
- name: Test with coverage
28+
run: flutter test --coverage
29+
30+
- name: Check coverage ≥ 80 %
31+
uses: VeryGoodOpenSource/very_good_coverage@v3
32+
with:
33+
path: coverage/lcov.info
34+
min_coverage: 80
35+
36+
- name: Upload coverage
37+
uses: codecov/codecov-action@v4
38+
with:
39+
files: coverage/lcov.info
40+
if: always()

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## [0.5.0] - 2026-03-25 — Publication readiness
2+
3+
### New API
4+
* `EditorController.fromJson(String jsonString, {BlockTypeRegistry? typeRegistry})` — creates a controller pre-populated from an existing EditorJS JSON string; gracefully handles invalid JSON.
5+
6+
### Package metadata
7+
* `pubspec.yaml` — updated description and added `topics` (editor, rich-text, editorjs, content).
8+
* `example/` directory added — two-tab demo app showing `EditorJSView` (viewer tab) and `EditorJSEditor` (editor tab).
9+
10+
### CI / CD
11+
* `.github/workflows/ci.yml` added — runs `flutter analyze` + `flutter test --coverage` on every PR and push to `master`; enforces ≥ 80 % line coverage via `VeryGoodOpenSource/very_good_coverage@v3`; uploads report to Codecov.
12+
13+
### Contribution rules
14+
* 80 % minimum test coverage enforced in CI — PRs that drop below this threshold cannot be merged.
15+
* `CLAUDE.md` updated with contribution rules, refreshed block types table, and updated backlog.
16+
17+
### Tests
18+
* Added `test/unit/block_entities_test.dart``toJson()` and `type` getter for all 14 block entities.
19+
* Added `test/unit/html_style_builder_test.dart``HtmlStyleBuilder.build()` with various configs.
20+
* Extended `test/widget/renderers_test.dart` — paragraph, quote, list (flat/ordered/nested), table, image, linkTool, raw.
21+
* Added `test/widget/editorjs_view_test.dart` — integration tests for the full parse → render pipeline.
22+
* Added `test/widget/editorjs_editor_test.dart` — editor + block controls + `fromJson` round-trip.
23+
* Added `test/widget/toolbar_test.dart` — toolbar button interactions and hyperlink dialog.
24+
* Added `test/widget/block_editors_test.dart` — individual editor widgets (paragraph, list, checklist, table, image, header, quote, warning, code).
25+
26+
---
27+
128
## [0.4.0] - 2026-03-25 — Phase 4: Quality & Safety
229

330
### Null-safety hardening

CLAUDE.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,20 @@ final config = EditorConfig(
109109

110110
| Block | Viewer | Editor | Notes |
111111
|---|---|---|---|
112-
| `header` | H1–H6 | Yes | |
113-
| `paragraph` | HTML via flutter_html | Yes | |
114-
| `list` | Flat ordered/unordered | Yes | Nested lists not yet supported |
115-
| `delimiter` | Divider | Yes | |
116-
| `image` | Network URL | Yes | caption/border/stretch not yet rendered |
117-
| `quote` | Planned | Planned | |
118-
| `code` | Planned | Planned | |
119-
| `table` | Planned | Planned | |
120-
| `checklist` | Planned | Planned | |
112+
| `header` | H1–H6 || |
113+
| `paragraph` | HTML via flutter_html || Inline format bar (B/I/U/S/code/mark) |
114+
| `list` | Ordered / unordered / nested || |
115+
| `delimiter` | Divider || |
116+
| `image` | Network URL || caption/border/stretch parsed; image_picker not wired |
117+
| `quote` | With alignment || |
118+
| `code` | Monospace + copy button || |
119+
| `checklist` | Checked / unchecked || |
120+
| `table` | With optional heading row || |
121+
| `warning` | Title + message || |
122+
| `embed` | Tappable card | Viewer only | |
123+
| `linkTool` | Link preview card | Viewer only | |
124+
| `attaches` | File download card | Viewer only | |
125+
| `raw` | Sanitized HTML | Viewer only | |
121126

122127
---
123128

@@ -159,6 +164,15 @@ When building new features, always work bottom-up:
159164
- `demo/lib/createnote.dart` — editor usage example
160165
- `demo/test_data/` — sample EditorJS JSON and styles JSON
161166

167+
## Contribution Rules
168+
169+
1. All new code must be covered by unit or widget tests.
170+
2. **Minimum test coverage: 80 %** — the CI workflow enforces this via `VeryGoodOpenSource/very_good_coverage`. PRs that drop coverage below 80 % will fail CI and cannot be merged.
171+
3. Run `fvm flutter analyze` locally before pushing — zero issues required.
172+
4. Run `fvm flutter test --coverage` locally and verify the coverage threshold.
173+
5. Follow the Clean Architecture layer rules: no Flutter imports in `domain/`, no direct widget dependencies in `data/`.
174+
6. New block types must be added bottom-up: entity → mapper → renderer → (editor) → register in both registries → export from barrel.
175+
162176
## Git Workflow
163177

164178
**This repo has branch protection. Direct commits to `master` are not allowed.**
@@ -216,7 +230,7 @@ When building new features, always work bottom-up:
216230

217231
## Versioning
218232

219-
Current version: `0.1.0` (in `pubspec.yaml`).
233+
Current version: `0.5.0` (in `pubspec.yaml`).
220234

221235
When making changes, always update `CHANGELOG.md` with a new entry at the top following the existing format:
222236
- Bump the patch version for bug fixes
@@ -225,8 +239,9 @@ When making changes, always update `CHANGELOG.md` with a new entry at the top fo
225239

226240
## Known Issues / Backlog
227241

228-
- Image `caption`, `withBorder`, `stretched`, `withBackground` fields parsed but not rendered
229-
- Nested lists not supported
230-
- No HTML sanitization before passing to `flutter_html` (XSS risk with untrusted JSON)
231-
- All tests are commented out — need full test coverage
232-
- `quote`, `code`, `table`, `checklist` blocks not yet implemented
242+
- `image_picker` is declared as a dependency but `ImageEditor` only accepts a URL string — picker not wired up
243+
- No `EditorController` content persistence to local storage (save/load)
244+
- No inline link editor in paragraph (currently inserts a `<a>` paragraph block via dialog)
245+
- No drag-to-reorder for blocks (only up/down buttons)
246+
- Typing history not tracked by undo/redo (only structural operations are undoable)
247+
- pub.dev publication pending — description, topics, and example are ready but package has not been published yet

0 commit comments

Comments
 (0)