Skip to content

Commit e61dc6a

Browse files
fix: resolve 8 bugs + bump version to 1.2.2
Android build (#5): - Add subprojects compileSdk=35 override in example/android/build.gradle.kts to fix irondash_engine_context vs androidx.fragment:1.7.1 mismatch SVG invisible with sanitize:true (html_sanitizer.dart): - Add atomic SVG sanitization path (_sanitizeSvgElement, _sanitizeSvgAttributes) preserving structural elements while stripping scripts/dangerous attrs HyperRenderConfig equality (hyper_render_config.dart): - Add operator== and hashCode to prevent identity-compare re-layouts on every frame when _effectiveConfig merges keyframes into a new object selectable toggle ignored after build (hyper_viewer.dart): - Create/dispose VirtualizedSelectionController in didUpdateWidget when selectable prop changes Deep-link tap silently blocked (hyper_viewer.dart): - _safeOnLinkTap now checks both allowedCustomSchemes AND renderConfig.extraLinkSchemes CSS change did not invalidate section cache (hyper_viewer.dart): - Reset _sectionHashes in didUpdateWidget when customCss changes Markdown/Delta single-section in virtualized/paged mode (hyper_viewer.dart): - Add _splitIntoSections() helper; sync fallback now chunks at block boundaries renderConfig change only partially detected (hyper_viewer.dart): - didUpdateWidget uses full renderConfig != instead of only virtualizationChunkSize CSS float class names not detected (html_adapter.dart): - _containsFloatChild now recognises Bootstrap/Tailwind float class patterns Misc: - Fix unused element _containsPositionAbsoluteOrFixed in html_heuristics.dart - Add .pubignore entries for archive/, coverage/, .metadata, pubspec_dev.yaml - dart format all changed files
1 parent 3815fd5 commit e61dc6a

14 files changed

Lines changed: 753 additions & 428 deletions

.pubignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ scripts/
4343
# Internal publish helpers
4444
pubspec.yaml.backup
4545
pubspec_publish_ready.yaml
46+
pubspec_dev.yaml
47+
48+
# Flutter .metadata files (auto-generated, not useful to consumers)
49+
.metadata
50+
51+
# Internal archive / historical comparison docs
52+
archive/
53+
54+
# Coverage artifacts
55+
coverage/
4656

4757
# IDE files
4858
*.iml

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Changelog
22

3-
## [1.2.2] - 2026-04-01
3+
## [1.2.2] - 2026-04-02
44

55
### 🐛 Bug Fixes
66

77
- **Android build failure with modern compileSdk** (`example/android/build.gradle.kts`): `irondash_engine_context 0.5.5` was compiled against android-31 but its transitive `androidx.fragment:1.7.1` dependency has `minCompileSdk=34`, causing AGP 8's `checkAarMetadata` to block the build. Added a `subprojects { afterEvaluate { compileSdk = 35 } }` override in the example's root Gradle file. README now documents the same one-line workaround for app-level projects. ([#5](https://github.com/brewkits/hyper_render/issues/5))
8+
- **SVG invisible with `sanitize: true`** (`html_sanitizer.dart`): `<svg>` was not in `defaultAllowedTags` so the sanitizer unwrapped it, destroying the SVG structure. Added an atomic SVG sanitization path that strips `<script>` and dangerous attributes while preserving all structural SVG elements (`path`, `circle`, `g`, `use`, etc.).
9+
- **`selectable` toggle ignored after build** (`hyper_viewer.dart`): Toggling `selectable` from `false``true` never created `VirtualizedSelectionController`, and `true``false` never disposed it. Fixed in `didUpdateWidget`.
10+
- **Deep-link tap silently blocked** (`hyper_viewer.dart`): `_safeOnLinkTap` only checked `widget.allowedCustomSchemes` but ignored `renderConfig.extraLinkSchemes`, causing deep-links registered via `HyperRenderConfig` to be silently dropped. Both sources are now consulted.
11+
- **CSS change didn't invalidate section cache** (`hyper_viewer.dart`): `_hashSection` hashes only text content, so a `customCss` change that alters layout/appearance would incorrectly reuse cached sections. `_sectionHashes` is now reset whenever `customCss` changes in `didUpdateWidget`.
12+
- **Markdown/Delta virtualized/paged mode rendered as single section** (`hyper_viewer.dart`): The sync fallback path wrapped the entire parsed document as one section, defeating virtualization. Added `_splitIntoSections()` to chunk Markdown/Delta documents at block boundaries, matching the HTML isolate path.
13+
- **`renderConfig` change only partially detected** (`hyper_viewer.dart`): `didUpdateWidget` compared only `virtualizationChunkSize` instead of the full `HyperRenderConfig`. Now uses full value equality (available since the `operator==` fix) so any config change triggers a re-parse.
14+
- **CSS float class names not detected** (`html_adapter.dart`): `_containsFloatChild` missed Bootstrap/Tailwind float class names (`float-left`, `pull-right`, `alignleft`, etc.), causing premature section splits after float-containing blocks. Common class patterns are now detected heuristically.
815

916
## [1.2.1] - 2026-03-31
1017

example/lib/reader_app/book_model.dart

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class Book {
99
final BookType type;
1010
final String? description;
1111

12-
// New persistent fields
13-
int lastPage;
14-
bool isBookmarked;
12+
// Persistent fields - marked as final for immutability where possible
13+
final int lastPage;
14+
final bool isBookmarked;
1515

1616
Book({
1717
required this.id,
@@ -24,6 +24,23 @@ class Book {
2424
this.lastPage = 0,
2525
this.isBookmarked = false,
2626
});
27+
28+
Book copyWith({
29+
int? lastPage,
30+
bool? isBookmarked,
31+
}) {
32+
return Book(
33+
id: id,
34+
title: title,
35+
author: author,
36+
coverUrl: coverUrl,
37+
content: content,
38+
type: type,
39+
description: description,
40+
lastPage: lastPage ?? this.lastPage,
41+
isBookmarked: isBookmarked ?? this.isBookmarked,
42+
);
43+
}
2744
}
2845

2946
class MockLibrary {

0 commit comments

Comments
 (0)