open markdown files in the reader, not the editor
The files panel and the Claude Config tab called ipc.request('editor.open')
for every file, which targets the editor — so a .md click never reached the
right-side markdown reader (it opens only when something publishes
('builtin.markdown','selection')). Route .md clicks from the files panel
(tree + filtered rows), the Config tab's file-backed rows, and .md wiki links
in the viewer to that channel; non-.md files still open in the editor. Also
remove the dead DaemonEvent fallback that listened for 'editor.buffer_activated'
(the registry emits 'editor.active-changed').
T-187.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -535,7 +535,8 @@ class _ClaudeMetaSidebarState extends State<ClaudeMetaSidebar> {
|
||||
}
|
||||
|
||||
/// A tappable row for file-backed items (skills, agents, commands).
|
||||
/// Fires `editor.open` with the path when tapped (D-6, T-183).
|
||||
/// All config items are .md files — opens in the markdown reader panel
|
||||
/// via the kernel MessageBus (D-6, T-183).
|
||||
Widget _configFileRow(SurfaceTokens tokens, String name, String? path) {
|
||||
final row = Padding(
|
||||
padding: const EdgeInsets.only(left: 16, top: 2, bottom: 2),
|
||||
@@ -546,14 +547,15 @@ class _ClaudeMetaSidebarState extends State<ClaudeMetaSidebar> {
|
||||
),
|
||||
);
|
||||
if (path == null) return row;
|
||||
void openMarkdown() => ClideKernel.of(context).messages.publish('builtin.markdown', 'selection', {'path': path});
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: name,
|
||||
excludeSemantics: true,
|
||||
onTap: () => unawaited(ClideKernel.of(context).ipc.request('editor.open', args: {'path': path})),
|
||||
onTap: openMarkdown,
|
||||
child: ClideTappable(
|
||||
tooltip: path,
|
||||
onTap: () => unawaited(ClideKernel.of(context).ipc.request('editor.open', args: {'path': path})),
|
||||
onTap: openMarkdown,
|
||||
builder: (ctx, hovered, _) => Padding(
|
||||
padding: const EdgeInsets.only(left: 16, top: 2, bottom: 2),
|
||||
child: ClideText(
|
||||
|
||||
@@ -212,14 +212,19 @@ class _FileRow extends StatelessWidget {
|
||||
|
||||
void _openFile(BuildContext context, String path) {
|
||||
final kernel = ClideKernel.of(context);
|
||||
// editor.open is a daemon-side IPC handler (lib/src/daemon/
|
||||
// editor_commands.dart), not a kernel command. Fire the request
|
||||
// and let the editor extension's controller pick up the
|
||||
// editor.active-changed / editor.opened event — no need to await
|
||||
// or handle the response here.
|
||||
unawaited(
|
||||
kernel.ipc.request('editor.open', args: {'path': path}),
|
||||
);
|
||||
if (path.toLowerCase().endsWith('.md')) {
|
||||
// Route .md files to the markdown reader panel via the kernel MessageBus.
|
||||
kernel.messages.publish('builtin.markdown', 'selection', {'path': path});
|
||||
} else {
|
||||
// editor.open is a daemon-side IPC handler (lib/src/daemon/
|
||||
// editor_commands.dart), not a kernel command. Fire the request
|
||||
// and let the editor extension's controller pick up the
|
||||
// editor.active-changed / editor.opened event — no need to await
|
||||
// or handle the response here.
|
||||
unawaited(
|
||||
kernel.ipc.request('editor.open', args: {'path': path}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +287,11 @@ class _FilteredFileRow extends StatelessWidget {
|
||||
return ClideTappable(
|
||||
onTap: () {
|
||||
final kernel = ClideKernel.of(context);
|
||||
unawaited(kernel.ipc.request('editor.open', args: {'path': entry.path}));
|
||||
if (entry.path.toLowerCase().endsWith('.md')) {
|
||||
kernel.messages.publish('builtin.markdown', 'selection', {'path': entry.path});
|
||||
} else {
|
||||
unawaited(kernel.ipc.request('editor.open', args: {'path': entry.path}));
|
||||
}
|
||||
},
|
||||
builder: (context, hovered, _) => Container(
|
||||
color: hovered ? tokens.sidebarItemHover : null,
|
||||
|
||||
@@ -16,7 +16,6 @@ class _MarkdownViewerState extends State<MarkdownViewer> {
|
||||
String? _content;
|
||||
String? _error;
|
||||
StreamSubscription<Message>? _selectionSub;
|
||||
StreamSubscription<DaemonEvent>? _editorSub;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
@@ -27,20 +26,11 @@ class _MarkdownViewerState extends State<MarkdownViewer> {
|
||||
final path = msg.data['path'] as String?;
|
||||
if (path != null) _loadFile(path);
|
||||
});
|
||||
_editorSub = kernel.events.on<DaemonEvent>().listen((e) {
|
||||
if (e.kind == 'editor.buffer_activated') {
|
||||
final path = e.data['path'] as String?;
|
||||
if (path != null && path.endsWith('.md')) {
|
||||
_loadFile(path);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_selectionSub?.cancel();
|
||||
_editorSub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -62,7 +52,10 @@ class _MarkdownViewerState extends State<MarkdownViewer> {
|
||||
|
||||
void _navigateToRecord(BuildContext context, String id) {
|
||||
final kernel = ClideKernel.of(context);
|
||||
if (id.startsWith('T-')) {
|
||||
if (id.toLowerCase().endsWith('.md')) {
|
||||
// Wiki-link to another .md file — open it in the reader.
|
||||
kernel.messages.publish('builtin.markdown', 'selection', {'path': id});
|
||||
} else if (id.startsWith('T-')) {
|
||||
kernel.messages.publish('builtin.tickets', 'selection', {'id': id});
|
||||
} else {
|
||||
kernel.messages.publish('builtin.decisions', 'selection', {'id': id});
|
||||
|
||||
Reference in New Issue
Block a user