From 1f9af78c3c413eb86657556e7cc9083aa415b3e9 Mon Sep 17 00:00:00 2001 From: Logan <22101261+log-li@users.noreply.github.com> Date: Fri, 14 Aug 2026 12:59:17 +0800 Subject: [PATCH] fix: enable selection-to-conversation popup in the markdown editor The "add to conversation" selection popup was registered only for the catch-all code viewer (viewerId === 'code'), so selecting text in the CodeMirror editor of a markdown file produced no popup; insertion only worked in markdown preview mode via the separate DOM-selection handler. Extend the CodeMirror selection popup to the markdown editor (viewerId === 'markdown') so line-exact selections can be injected into the composer draft (\`\`\`rel/path:start-end\`\`\` payload), matching preview-mode behavior and the code viewer. --- src/client/TextEditor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/TextEditor.tsx b/src/client/TextEditor.tsx index 5594e35..2e3377e 100644 --- a/src/client/TextEditor.tsx +++ b/src/client/TextEditor.tsx @@ -141,11 +141,11 @@ export function TextEditor(props: FileViewerProps) { ...defaultKeymap, ...historyKeymap, ]), - // Selection popup (the catch-all code viewer only): a non-empty + // Selection popup (the code and markdown editors): a non-empty // selection anchors the floating "add to conversation" button above // its head. Scrolling (geometry/viewport change) or losing focus // hides it; typing collapses the selection and hides it too. - ...(viewerId === 'code' ? [ + ...(viewerId === 'code' || viewerId === 'markdown' ? [ CodeMirrorView.updateListener.of((update) => { if (update.geometryChanged || update.viewportChanged) { hidePopup()