Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.41.5'
channel: stable

- name: Install dependencies
run: flutter pub get

- name: Analyze
run: flutter analyze

- name: Test with coverage
run: flutter test --coverage

Comment on lines +16 to +29
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI installs Flutter via subosito/flutter-action with channel: stable, which can drift from the repo’s pinned Flutter version (see .fvmrc -> 3.41.5) and also conflicts with the documented convention that Flutter commands should run via fvm flutter ... (CLAUDE.md:33). To keep CI reproducible and consistent with local dev, pin the exact Flutter version from .fvmrc (or use flutter-version-file: .fvmrc if supported) and consider running commands via FVM (or otherwise document why CI intentionally differs).

Copilot uses AI. Check for mistakes.
- name: Check coverage ≥ 80 %
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: coverage/lcov.info
min_coverage: 80

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: coverage/lcov.info
if: always()
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## [0.5.0] - 2026-03-25 — Publication readiness

### New API
* `EditorController.fromJson(String jsonString, {BlockTypeRegistry? typeRegistry})` — creates a controller pre-populated from an existing EditorJS JSON string; gracefully handles invalid JSON.

### Package metadata
* `pubspec.yaml` — updated description and added `topics` (editor, rich-text, editorjs, content).
* `example/` directory added — two-tab demo app showing `EditorJSView` (viewer tab) and `EditorJSEditor` (editor tab).

### CI / CD
* `.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.

### Contribution rules
* 80 % minimum test coverage enforced in CI — PRs that drop below this threshold cannot be merged.
* `CLAUDE.md` updated with contribution rules, refreshed block types table, and updated backlog.

### Tests
* Added `test/unit/block_entities_test.dart` — `toJson()` and `type` getter for all 14 block entities.
* Added `test/unit/html_style_builder_test.dart` — `HtmlStyleBuilder.build()` with various configs.
* Extended `test/widget/renderers_test.dart` — paragraph, quote, list (flat/ordered/nested), table, image, linkTool, raw.
* Added `test/widget/editorjs_view_test.dart` — integration tests for the full parse → render pipeline.
* Added `test/widget/editorjs_editor_test.dart` — editor + block controls + `fromJson` round-trip.
* Added `test/widget/toolbar_test.dart` — toolbar button interactions and hyperlink dialog.
* Added `test/widget/block_editors_test.dart` — individual editor widgets (paragraph, list, checklist, table, image, header, quote, warning, code).

---

## [0.4.0] - 2026-03-25 — Phase 4: Quality & Safety

### Null-safety hardening
Expand Down
45 changes: 30 additions & 15 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,20 @@ final config = EditorConfig(

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

---

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

## Contribution Rules

1. All new code must be covered by unit or widget tests.
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.
3. Run `fvm flutter analyze` locally before pushing — zero issues required.
4. Run `fvm flutter test --coverage` locally and verify the coverage threshold.
5. Follow the Clean Architecture layer rules: no Flutter imports in `domain/`, no direct widget dependencies in `data/`.
6. New block types must be added bottom-up: entity → mapper → renderer → (editor) → register in both registries → export from barrel.

## Git Workflow

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

## Versioning

Current version: `0.1.0` (in `pubspec.yaml`).
Current version: `0.5.0` (in `pubspec.yaml`).

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

## Known Issues / Backlog

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