feat(files): comment on selection in read-only markdown previews

Selecting text in a rendered markdown preview shows a Comment pill;
attaching stores a file-quote context draft carrying the file path, the
selected fragment (not whole lines), the user's comment, and a
best-effort source line range resolved by anchoring the fragment's
first and last lines in the raw content — a partially located fragment
gets no range rather than a misleading one. The fragment stays
highlighted while the comment input is open, using the selection
overlay rects shared with chat quote comments, and the preview's
native selection color now matches chat messages. file-quote flows
through the same context contract: composer chip previews, the message
context card, and the metadata round-trip.
This commit is contained in:
Bohdan Triapitsyn
2026-08-24 01:21:35 +03:00
parent e47c027ea0
commit eb03ffaa80
22 changed files with 411 additions and 58 deletions
+1
View File
@@ -2907,6 +2907,7 @@ export const dict = {
'chat.message.context.codeComment': 'Kommentar zu {file}, Zeilen {start}-{end}',
'chat.message.context.codeCommentLine': 'Kommentar zu {file}, Zeile {line}',
'chat.message.context.chatQuote': 'Zitat aus einer früheren Nachricht',
'chat.message.context.fileQuote': 'Auswahl aus {file}',
'chat.chatInput.chatQuoteContext': 'Chat-Zitate',
'chat.chatInput.chatQuoteContextRemove': 'Chat-Zitate entfernen',
'chat.chatInput.contextPreview.selectedLabel': 'Ausgewählter Text',
+1
View File
@@ -8,6 +8,7 @@ export const dict = {
'chat.message.context.codeComment': 'Comment on {file}, lines {start}-{end}',
'chat.message.context.codeCommentLine': 'Comment on {file}, line {line}',
'chat.message.context.chatQuote': 'Quoted from an earlier message',
'chat.message.context.fileQuote': 'Selection from {file}',
'chat.chatInput.chatQuoteContext': 'Chat quotes',
'chat.chatInput.chatQuoteContextRemove': 'Remove chat quotes',
'chat.chatInput.contextPreview.selectedLabel': 'Selected text',
+1
View File
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': 'Comentario en {file}, líneas {start}-{end}',
'chat.message.context.codeCommentLine': 'Comentario en {file}, línea {line}',
'chat.message.context.chatQuote': 'Cita de un mensaje anterior',
'chat.message.context.fileQuote': 'Selección de {file}',
'chat.chatInput.chatQuoteContext': 'Citas del chat',
'chat.chatInput.chatQuoteContextRemove': 'Quitar citas del chat',
'chat.chatInput.contextPreview.selectedLabel': 'Texto seleccionado',
+1
View File
@@ -8,6 +8,7 @@ export const dict = {
'chat.message.context.codeComment': 'Commentaire sur {file}, lignes {start}-{end}',
'chat.message.context.codeCommentLine': 'Commentaire sur {file}, ligne {line}',
'chat.message.context.chatQuote': 'Citation d’un message précédent',
'chat.message.context.fileQuote': 'Sélection de {file}',
'chat.chatInput.chatQuoteContext': 'Citations du chat',
'chat.chatInput.chatQuoteContextRemove': 'Supprimer les citations du chat',
'chat.chatInput.contextPreview.selectedLabel': 'Texte sélectionné',
+1
View File
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': '{file} の {start}〜{end} 行へのコメント',
'chat.message.context.codeCommentLine': '{file} の {line} 行へのコメント',
'chat.message.context.chatQuote': '以前のメッセージからの引用',
'chat.message.context.fileQuote': '{file} からの選択',
'chat.chatInput.chatQuoteContext': 'チャット引用',
'chat.chatInput.chatQuoteContextRemove': 'チャット引用を削除',
'chat.chatInput.contextPreview.selectedLabel': '選択したテキスト',
+1
View File
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': '{file} {start}-{end}행에 대한 댓글',
'chat.message.context.codeCommentLine': '{file} {line}행에 대한 댓글',
'chat.message.context.chatQuote': '이전 메시지에서 인용',
'chat.message.context.fileQuote': '{file}에서 선택한 부분',
'chat.chatInput.chatQuoteContext': '채팅 인용',
'chat.chatInput.chatQuoteContextRemove': '채팅 인용 제거',
'chat.chatInput.contextPreview.selectedLabel': '선택한 텍스트',
+1
View File
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': 'Komentarz do {file}, wiersze {start}-{end}',
'chat.message.context.codeCommentLine': 'Komentarz do {file}, wiersz {line}',
'chat.message.context.chatQuote': 'Cytat z wcześniejszej wiadomości',
'chat.message.context.fileQuote': 'Zaznaczenie z {file}',
'chat.chatInput.chatQuoteContext': 'Cytaty z czatu',
'chat.chatInput.chatQuoteContextRemove': 'Usuń cytaty z czatu',
'chat.chatInput.contextPreview.selectedLabel': 'Zaznaczony tekst',
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': 'Comentário em {file}, linhas {start}-{end}',
'chat.message.context.codeCommentLine': 'Comentário em {file}, linha {line}',
'chat.message.context.chatQuote': 'Citação de uma mensagem anterior',
'chat.message.context.fileQuote': 'Seleção de {file}',
'chat.chatInput.chatQuoteContext': 'Citações do chat',
'chat.chatInput.chatQuoteContextRemove': 'Remover citações do chat',
'chat.chatInput.contextPreview.selectedLabel': 'Texto selecionado',
+1
View File
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': 'Коментар до {file}, рядки {start}-{end}',
'chat.message.context.codeCommentLine': 'Коментар до {file}, рядок {line}',
'chat.message.context.chatQuote': 'Цитата з попереднього повідомлення',
'chat.message.context.fileQuote': 'Виділене з {file}',
'chat.chatInput.chatQuoteContext': 'Цитати з чату',
'chat.chatInput.chatQuoteContextRemove': 'Прибрати цитати з чату',
'chat.chatInput.contextPreview.selectedLabel': 'Виділений текст',
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': '对 {file} 第 {start}-{end} 行的评论',
'chat.message.context.codeCommentLine': '对 {file} 第 {line} 行的评论',
'chat.message.context.chatQuote': '引用自先前的消息',
'chat.message.context.fileQuote': '来自 {file} 的选择',
'chat.chatInput.chatQuoteContext': '聊天引用',
'chat.chatInput.chatQuoteContextRemove': '移除聊天引用',
'chat.chatInput.contextPreview.selectedLabel': '所选文本',
@@ -9,6 +9,7 @@ export const dict: Record<I18nKey, string> = {
'chat.message.context.codeComment': '對 {file} 第 {start}-{end} 行的評論',
'chat.message.context.codeCommentLine': '對 {file} 第 {line} 行的評論',
'chat.message.context.chatQuote': '引用自先前的訊息',
'chat.message.context.fileQuote': '來自 {file} 的選取內容',
'chat.chatInput.chatQuoteContext': '聊天引用',
'chat.chatInput.chatQuoteContextRemove': '移除聊天引用',
'chat.chatInput.contextPreview.selectedLabel': '所選文字',