feat(app): browser-like tabs with per-tab history and persistence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 03:37:39 +01:00
1 parent 39e7e43071
commit 1e32cf0df3
8 files changed
+577 -33

No files matched your search

+6 -2
View File
@@ -317,8 +317,10 @@ class _BlockViewState extends State<BlockView> {
base: blockTextStyle(context),
refs: app.refs,
assetPath: app.backend.assetPath,
onPage: app.openTitle,
onBlockRef: (r) => app.openId(r.pageId),
onPage: (t) => app.navigate(PageTarget(title: t)),
onBlockRef: (r) => app.navigate(PageTarget(id: r.pageId)),
onPageNewTab: app.openTitleInNewTab,
onBlockRefNewTab: (r) => app.openIdInNewTab(r.pageId),
onUrl: openUrl,
onToggleTodo: () => widget.controller.cycleTodo(widget.node),
maxWidth: width,
@@ -708,6 +710,8 @@ class _BlockEditorState extends State<BlockEditor> {
return KeyEventResult.handled;
}
if (key == LogicalKeyboardKey.tab) {
// Ctrl+Tab switches app tabs (handled by the shell shortcuts).
if (ctrl) return KeyEventResult.ignored;
if (shift) {
c.outdent(n, caret: caret);
} else {
+20 -2
View File
@@ -65,6 +65,8 @@ class RenderContext {
required this.onBlockRef,
required this.onUrl,
this.onToggleTodo,
this.onPageNewTab,
this.onBlockRefNewTab,
this.maxWidth = 600,
});
@@ -76,6 +78,10 @@ class RenderContext {
final void Function(BlockRefDtoLike ref) onBlockRef;
final void Function(String url) onUrl;
final VoidCallback? onToggleTodo;
/// Middle-click on a page link or block ref.
final void Function(String title)? onPageNewTab;
final void Function(BlockRefDtoLike ref)? onBlockRefNewTab;
final double maxWidth;
}
@@ -298,6 +304,9 @@ class BlockRenderer {
fontWeight: FontWeight.w500,
),
onTap: () => ctx.onPage(title),
onMiddle: ctx.onPageNewTab == null
? null
: () => ctx.onPageNewTab!(title),
);
i = plain = close + 2;
continue;
@@ -476,11 +485,18 @@ class BlockRenderer {
return null;
}
void _text(String t, int s0, TextStyle style, {VoidCallback? onTap}) {
void _text(
String t,
int s0,
TextStyle style, {
VoidCallback? onTap,
VoidCallback? onMiddle,
}) {
if (t.isEmpty) return;
TapGestureRecognizer? rec;
if (onTap != null) {
rec = TapGestureRecognizer()..onTap = onTap;
if (onMiddle != null) rec.onTertiaryTapUp = (_) => onMiddle();
_recognizers.add(rec);
}
_spans.add(
@@ -513,7 +529,9 @@ class BlockRenderer {
TapGestureRecognizer? rec;
if (ref != null) {
rec = TapGestureRecognizer()
..onTap = () => ctx.onBlockRef(BlockRefDtoLike(ref.id, ref.pageId));
..onTap = (() => ctx.onBlockRef(BlockRefDtoLike(ref.id, ref.pageId)))
..onTertiaryTapUp = (_) =>
ctx.onBlockRefNewTab?.call(BlockRefDtoLike(ref.id, ref.pageId));
_recognizers.add(rec);
}
_spans.add(