Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(annotations): confirm notes explicitly and stabilize source markers (#8322)
Jiayuan Zhang2ae2dbbb8f9e
diff --git a/apps/docs/content/docs/comments.ja.mdx b/apps/docs/content/docs/comments.ja.mdxindex 7d1e0b24bc..1e8aebdc9c 100644--- a/apps/docs/content/docs/comments.ja.mdx+++ b/apps/docs/content/docs/comments.ja.mdx@@ -15,9 +15,9 @@ import { Callout } from "fumadocs-ui/components/callout";## コメントと説明に注釈を付ける-Web と Desktop では、自分を含む誰のコメントでも選択して選択ツールバーの **返信に追加** を押すと、そのスレッドの返信下書きに引用が追加されます。選択箇所の横で任意のコメントを入力すると自動保存され、完了操作は不要です。原文の番号をクリックすると再編集できます。入力欄の横のごみ箱ボタンで、その注釈と原文のマーク、下書きの項目をその場で削除できます。注釈件数にマウスを重ねるとポップアップで引用の確認・削除ができ、引用をクリックすると原文でコメントを編集できます。クリックやキーボードでも開けます。既存の送信ボタンで 1 件の返信として送信し、注釈の間には空行が入ります。タスク説明では選択ツールバーの **コメントに追加** を選びます。説明の注釈は新しいコメントの下書きに入り、送信すると新しいスレッドを作成します。コメントの注釈は元のスレッドへの返信になります。+Web と Desktop では、自分を含む誰のコメントでも選択して選択ツールバーの **返信に追加** を押すと、選択箇所の横にコメント入力欄が開きます。コメントを入力して**注釈を追加** を押すと、返信下書きに保存されて件数と番号に反映されます。編集時は **注釈を保存** で変更を確定します。空の内容は確定できません。Enter で確定、Shift + Enter で改行します。Esc または入力欄の外をクリックすると未確定の変更を取り消します。原文の番号をクリックすると再編集できます。入力欄の横のごみ箱ボタンで、その注釈と原文のマーク、下書きの項目をその場で削除できます。注釈件数にマウスを重ねるとポップアップで引用の確認・削除ができ、引用をクリックすると原文でコメントを編集できます。クリックやキーボードでも開けます。既存の送信ボタンで 1 件の返信として送信し、注釈の間には空行が入ります。投稿では注釈が先に表示され、その下に全体への返信が続きます。両方がある場合は区切り線で分けられます。タスク説明では選択ツールバーの **コメントに追加** を選びます。説明の注釈は新しいコメントの下書きに入り、送信すると新しいスレッドを作成します。コメントの注釈は元のスレッドへの返信になります。-コメントへの注釈では、最初の引用で返信先が決まります。ネストした返信も対象になり、同じスレッドの別のメッセージからも引用できます。注釈のコメントか全体への返信を入力し、既存の送信ボタンで 1 件のコメントとして投稿します。引用内のメンションは通知や実行を発生させません。自分で入力したメンションには通常のルールが適用されます。+コメントへの注釈では、最初に保存した注釈で返信先が決まります。ネストした返信も対象になり、同じスレッドの別のメッセージからも引用できます。必要に応じて全体への返信も入力し、既存の送信ボタンで 1 件のコメントとして投稿します。引用内のメンションは通知や実行を発生させません。自分で入力したメンションには通常のルールが適用されます。下書きはこのデバイスとワークスペース内だけに保存され、再読み込み後も復元されます。保存期間は 30 日です。返信ごとに最大 20 件の注釈、引用ごとに最大 4,000 文字を追加できます。原文が変更されても引用は残りますが、返信先が削除された場合は送信できません。Chat、モバイルでの注釈入力、デバイス間の下書き同期には対応していません。diff --git a/apps/docs/content/docs/comments.ko.mdx b/apps/docs/content/docs/comments.ko.mdxindex c86c78bc97..f0014a6ce9 100644--- a/apps/docs/content/docs/comments.ko.mdx+++ b/apps/docs/content/docs/comments.ko.mdx@@ -15,9 +15,9 @@ import { Callout } from "fumadocs-ui/components/callout";## 댓글과 설명에 주석 달기-Web과 Desktop에서 본인 댓글을 포함한 모든 댓글의 텍스트를 선택하고 선택 도구 모음의 **답글에 추가**를 누르면 해당 스레드의 답글 초안에 인용문이 즉시 추가됩니다. 선택한 위치 옆에서 의견을 입력하면 자동 저장되며 완료 버튼은 필요 없습니다. 원문의 번호 표시를 누르면 다시 편집할 수 있습니다. 입력란 옆의 휴지통 버튼으로 해당 주석과 원문 표시, 초안 항목을 그 자리에서 삭제할 수 있습니다. 주석 개수에 마우스를 올리면 팝업에서 인용문을 확인하거나 삭제하고, 인용문을 눌러 원문에서 의견을 편집할 수 있습니다. 클릭이나 키보드로도 팝업을 열 수 있습니다. 기존 전송 버튼으로 하나의 답글을 보내며 주석 사이에는 빈 줄이 들어갑니다. 작업 설명에서는 선택 도구 모음의 **댓글에 추가**를 누릅니다. 설명 주석은 새 댓글 초안에 추가되며 전송하면 새 스레드를 만듭니다. 댓글 주석은 원래 스레드의 답글로 전송됩니다.+Web과 Desktop에서 본인 댓글을 포함한 모든 댓글의 텍스트를 선택하고 선택 도구 모음의 **답글에 추가**를 누르면 선택한 위치 옆에 의견 입력란이 열립니다. 의견을 입력한 뒤 **주석 추가**를 누르면 답글 초안에 저장되고 주석 개수와 번호에 반영됩니다. 편집한 내용은 **주석 저장**을 눌러 확정합니다. 빈 내용은 확정할 수 없습니다. Enter는 확정, Shift + Enter는 줄바꿈입니다. Esc를 누르거나 입력란 밖을 클릭하면 미확정 변경을 취소합니다. 원문의 번호 표시를 누르면 다시 편집할 수 있습니다. 입력란 옆의 휴지통 버튼으로 해당 주석과 원문 표시, 초안 항목을 그 자리에서 삭제할 수 있습니다. 주석 개수에 마우스를 올리면 팝업에서 인용문을 확인하거나 삭제하고, 인용문을 눌러 원문에서 의견을 편집할 수 있습니다. 클릭이나 키보드로도 팝업을 열 수 있습니다. 기존 전송 버튼으로 하나의 답글을 보내며 주석 사이에는 빈 줄이 들어갑니다. 게시된 댓글에서는 주석이 먼저 표시되고 그 아래에 전체 답글이 이어집니다. 두 부분이 모두 있으면 구분선이 표시됩니다. 작업 설명에서는 선택 도구 모음의 **댓글에 추가**를 누릅니다. 설명 주석은 새 댓글 초안에 추가되며 전송하면 새 스레드를 만듭니다. 댓글 주석은 원래 스레드의 답글로 전송됩니다.-댓글 주석에서는 첫 인용문이 중첩 답글을 포함한 정확한 답글 대상을 결정합니다. 같은 스레드의 다른 메시지에서도 인용할 수 있습니다. 주석에 코멘트를 추가하거나 전체 답글을 작성한 뒤 기존 전송 버튼으로 하나의 댓글을 게시하세요. 인용문 안의 멘션은 알림이나 실행을 발생시키지 않으며, 직접 작성한 멘션에는 일반 규칙이 적용됩니다.+댓글 주석에서는 처음 저장한 주석이 중첩 답글을 포함한 정확한 답글 대상을 결정합니다. 같은 스레드의 다른 메시지에서도 인용할 수 있습니다. 필요하면 전체 답글도 작성한 뒤 기존 전송 버튼으로 하나의 댓글을 게시하세요. 인용문 안의 멘션은 알림이나 실행을 발생시키지 않으며, 직접 작성한 멘션에는 일반 규칙이 적용됩니다.초안은 이 기기와 워크스페이스에만 저장되며 새로고침 후 복원되고 30일 후 만료됩니다. 답글당 주석은 최대 20개, 인용문당 최대 4,000자입니다. 원문이 변경되어도 저장한 인용문은 유지되지만 답글 대상이 삭제되면 전송할 수 없습니다. Chat, 모바일 주석 입력, 기기 간 초안 동기화는 지원하지 않습니다.diff --git a/apps/docs/content/docs/comments.mdx b/apps/docs/content/docs/comments.mdxindex cbcb694245..62ffb0b6d8 100644--- a/apps/docs/content/docs/comments.mdx+++ b/apps/docs/content/docs/comments.mdx@@ -15,9 +15,9 @@ Replying to a comment forms a discussion thread. Replies can nest further, but t## Annotate comments and descriptions-On Web and Desktop, select text in any posted comment, including your own and choose **Add to reply** in the selection toolbar. The quote is immediately added to that thread’s reply draft. Write an optional note beside the selection; it saves as you type, with no Done step. Click the numbered source marker to edit it again. The trash button beside the note removes that annotation directly at the source, including its highlight and draft entry. Hover over the annotation count to inspect or remove quotes in a floating panel, or click a quote to edit its note at the source. You can also open the panel by clicking or using the keyboard. Send everything as one reply with the existing send button, with a blank line between annotations. For an issue description, choose **Add to comment** in its selection toolbar. Description annotations join the new-comment draft and are sent as a new thread; comment annotations stay in their original thread.+On Web and Desktop, select text in any posted comment, including your own and choose **Add to reply** in the selection toolbar. Write a note beside the selection, then click **Add annotation** to add it to the reply draft. Only confirmed, non-empty notes receive a count and source marker. When editing, click **Save annotation** to apply changes. Enter confirms; Shift + Enter inserts a newline. Escape or clicking outside cancels unconfirmed changes. Click the numbered source marker to edit it again. The trash button beside the note removes that annotation directly at the source, including its highlight and draft entry. Hover over the annotation count to inspect or remove quotes in a floating panel, or click a quote to edit its note at the source. You can also open the panel by clicking or using the keyboard. Send everything as one reply with the existing send button, with a blank line between annotations. Annotations appear first, followed by your overall reply, with a divider between the two sections when both are present. For an issue description, choose **Add to comment** in its selection toolbar. Description annotations join the new-comment draft and are sent as a new thread; comment annotations stay in their original thread.-For comment annotations, the first quote fixes the reply target, including nested replies. Quotes from other messages in that discussion join the same draft. Add at least one note or an overall reply, then use the existing send button to publish everything as one comment. Quoted mentions do not notify or trigger anyone; mentions you write yourself follow the normal rules.+For comment annotations, the first saved annotation fixes the reply target, including nested replies. Quotes from other messages in that discussion join the same draft. Use the existing send button to publish everything as one comment. Quoted mentions do not notify or trigger anyone; mentions you write yourself follow the normal rules.Drafts are private to this device and workspace, survive reloads, and expire after 30 days. Each reply supports up to 20 annotations, with up to 4,000 characters per quote. If a source changes, its saved quote remains; if the reply target is deleted, sending is blocked. Chat, mobile annotation entry, and cross-device draft sync are not included.diff --git a/apps/docs/content/docs/comments.zh.mdx b/apps/docs/content/docs/comments.zh.mdxindex fa4954098d..b10c9e6052 100644--- a/apps/docs/content/docs/comments.zh.mdx+++ b/apps/docs/content/docs/comments.zh.mdx@@ -15,9 +15,9 @@ import { Callout } from "fumadocs-ui/components/callout";## 批注评论与任务描述-在 Web 或 Desktop 中,选中任意已发表的评论文字,包括自己的评论,点击选区工具条中的 **加入回复**,引用即加入当前讨论的 reply 草稿。可在选区旁填写意见,随写随存,无需点击完成;点击原文编号标记可继续编辑,也可点击批注框右侧的删除图标,直接移除该批注及其原文标记和草稿条目。鼠标悬停在批注计数上,即可在浮层中查看、删除引用,或点击引用返回原位编辑意见;也支持点击或使用键盘打开浮层。通过原有发送按钮合并发送为一条回复,各条批注之间保留一个空行,任务描述的选区工具条提供 **加入评论**,批注进入新评论草稿,发送后创建新的讨论;评论批注仍进入原讨论的回复草稿。+在 Web 或 Desktop 中,选中任意已发表的评论文字,包括自己的评论,点击选区工具条中的 **加入回复**,在选区旁填写意见,再点击 **添加批注**,批注才加入当前讨论的回复草稿并显示编号。编辑已有批注后,点击 **保存批注** 才会应用修改。空内容无法确认。Enter 确认,Shift + Enter 换行;Esc 或点击框外会取消本次未确认的修改。点击原文编号标记可继续编辑,也可点击批注框右侧的删除图标,直接移除该批注及其原文标记和草稿条目。鼠标悬停在批注计数上,即可在浮层中查看、删除引用,或点击引用返回原位编辑意见;也支持点击或使用键盘打开浮层。通过原有发送按钮合并发送为一条回复,各条批注之间保留一个空行。发布后先显示批注,再显示你在输入框中填写的整体回复;两部分都有内容时,中间显示分隔线。任务描述的选区工具条提供 **加入评论**,批注进入新评论草稿,发送后创建新的讨论;评论批注仍进入原讨论的回复草稿。-评论批注的首次引用会确定具体回复目标,包括嵌套回复。同一讨论中其他消息的引用会加入这份草稿。填写至少一条批注内容或整体回复后,使用原有发送按钮,将全部内容作为一条评论发布。引用中的提及不会通知或触发任何人;你自己填写的提及仍遵循普通规则。+首次保存的评论批注会确定具体回复目标,包括嵌套回复。同一讨论中其他消息的引用会加入这份草稿。使用原有发送按钮,将全部内容作为一条评论发布。引用中的提及不会通知或触发任何人;你自己填写的提及仍遵循普通规则。草稿仅保存在当前设备和工作区,刷新后可恢复,30 天后过期。每条回复最多包含 20 条批注,每次引用最多 4,000 个字符。原文更改后仍保留引用快照;回复目标被删除时会阻止发送。首版不包含 Chat、移动端批注输入或跨设备草稿同步。diff --git a/packages/core/drafts/reply-annotation.test.ts b/packages/core/drafts/reply-annotation.test.tsindex d8c1653f97..ced7d9d393 100644--- a/packages/core/drafts/reply-annotation.test.ts+++ b/packages/core/drafts/reply-annotation.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { parseMentions } from "../issues/comment-trigger-outcomes";import { composeAnnotatedReply, hasReplyIntent, locateReplyAnnotation, normalizeReplyAnnotations, type ReplyAnnotation } from "./reply-annotation";@@ -8,9 +9,21 @@ const annotation: ReplyAnnotation = {};describe("annotated reply serialization", () => {- it("publishes only the user body, quotes and notes, without source links or labels", () => {+ it("puts annotations before the overall reply with a section divider", () => {expect(composeAnnotatedReply("Overall reply", [annotation, { ...annotation, id: "b", quote: "other", note: "" }]))- .toBe("Overall reply\n\n> first\n> second\n\nPlease revise.\n\n \n\n> other");+ .toBe("> first\n> second\n\nPlease revise.\n\n---\n\nOverall reply");+ });++ it("only adds a divider when both sections have content", () => {+ expect(composeAnnotatedReply("Overall reply", [])).toBe("Overall reply");+ expect(composeAnnotatedReply("Overall reply", [{ ...annotation, note: " " }])).toBe("Overall reply");+ expect(composeAnnotatedReply(" ", [annotation])).toBe("> first\n> second\n\nPlease revise.");+ });++ it("keeps /note as a command while placing the remaining body below annotations", () => {+ expect(composeAnnotatedReply(" /NOTE\nPrivate", [annotation])).toBe("/NOTE\n\n> first\n> second\n\nPlease revise.\n\n---\n\nPrivate");+ expect(composeAnnotatedReply("/note", [annotation])).toBe("/note\n\n> first\n> second\n\nPlease revise.");+ expect(composeAnnotatedReply("/notes are ordinary text", [annotation])).toBe("> first\n> second\n\nPlease revise.\n\n---\n\n/notes are ordinary text");});it("preserves user-authored note Markdown and links without list indentation", () => {@@ -29,7 +42,7 @@ describe("annotated reply serialization", () => {});it("retains /note behavior and does not send quotes alone", () => {- expect(composeAnnotatedReply("/note Private", [annotation])).toMatch(/^\/note Private/);+ expect(composeAnnotatedReply("/note Private", [annotation])).toBe("/note\n\n> first\n> second\n\nPlease revise.\n\n---\n\nPrivate");expect(hasReplyIntent(" ", [{ ...annotation, note: " " }])).toBe(false);expect(hasReplyIntent("", [annotation])).toBe(true);expect(hasReplyIntent("Overall", [{ ...annotation, note: "" }])).toBe(true);@@ -37,7 +50,7 @@ describe("annotated reply serialization", () => {it("normalizes old and corrupt drafts without inventing annotations", () => {expect(normalizeReplyAnnotations(undefined)).toEqual([]);- expect(normalizeReplyAnnotations([null, {}, { ...annotation, quote: "x".repeat(4001) }, annotation])).toEqual([annotation]);+ expect(normalizeReplyAnnotations([null, {}, { ...annotation, note: " " }, { ...annotation, quote: "x".repeat(4001) }, annotation])).toEqual([annotation]);});});diff --git a/packages/core/drafts/reply-annotation.ts b/packages/core/drafts/reply-annotation.tsindex 0a7461e86e..11012b00dd 100644--- a/packages/core/drafts/reply-annotation.ts+++ b/packages/core/drafts/reply-annotation.ts@@ -24,7 +24,7 @@ export function normalizeReplyAnnotations(value: unknown): ReplyAnnotation[] {typeof a.id === "string" && typeof a.sourceCommentId === "string" &&typeof a.sourceActorName === "string" && typeof a.quote === "string" &&a.quote.trim().length > 0 && a.quote.length <= MAX_ANNOTATION_QUOTE_LENGTH &&- typeof a.note === "string" && Number.isInteger(a.start) && a.start >= 0 &&+ typeof a.note === "string" && a.note.trim().length > 0 && Number.isInteger(a.start) && a.start >= 0 &&typeof a.prefix === "string" && typeof a.suffix === "string" &&(a.sourceRevision === undefined || Number.isInteger(a.sourceRevision)),).slice(0, MAX_REPLY_ANNOTATIONS);@@ -55,15 +55,19 @@ function quoteText(text: string): string {export function composeAnnotatedReply(content: string, annotations: readonly ReplyAnnotation[]): string {const body = content.trim();- if (!annotations.length) return body;- // Keep the user's leading /note command (and explicit mentions) in place.- const quotes = annotations.map((a) =>+ const saved = annotations.filter((a) => a.note.trim());+ if (!saved.length) return body;+ // /note must remain the first token so annotations cannot change triggering.+ const command = body.match(/^\/note(?=\s|$)/i)?.[0];+ const reply = command ? body.slice(command.length).trim() : body;+ const quotes = saved.map((a) =>a.quote.split(/\r?\n/).map((line) => `> ${quoteText(line)}`).join("\n") +- (a.note.trim() ? `\n\n${a.note.trim()}` : ""),+ `\n\n${a.note.trim()}`,);// Markdown collapses extra newlines. A blank paragraph keeps one visible- // empty line between annotations and separates adjacent quote-only blocks.- return [body, quotes.join("\n\n \n\n")].filter(Boolean).join("\n\n");+ // empty line between annotations.+ const sections = [quotes.join("\n\n \n\n"), reply].filter(Boolean).join("\n\n---\n\n");+ return command ? `${command}\n\n${sections}` : sections;}/** Relocate only an unambiguous quote with matching context after source edits. */diff --git a/packages/core/issues/stores/comment-draft-store.test.ts b/packages/core/issues/stores/comment-draft-store.test.tsindex 36626ab20b..8a0e241f76 100644--- a/packages/core/issues/stores/comment-draft-store.test.ts+++ b/packages/core/issues/stores/comment-draft-store.test.ts@@ -331,7 +331,7 @@ describe("comment draft store — upload lifecycle", () => {describe("reply annotations", () => {const key = "reply:issue-1:root" as const;- const annotation = { id: "a", sourceCommentId: "nested-agent", sourceActorName: "Emacs", quote: "Selected text", note: "", start: 0, prefix: "", suffix: "" };+ const annotation = { id: "a", sourceCommentId: "nested-agent", sourceActorName: "Emacs", quote: "Selected text", note: "A note", start: 0, prefix: "", suffix: "" };beforeEach(async () => {setCurrentWorkspace("annotation-tests", "ws_annotations");await flush();@@ -355,6 +355,33 @@ describe("reply annotations", () => {expect(store.getDraft(key)).toBeUndefined();});+ it("rejects blank notes and removes cleared notes without losing the reply body", () => {+ const store = useCommentDraftStore.getState();+ expect(store.addAnnotation(key, { ...annotation, note: " " })).toBeUndefined();+ expect(useCommentDraftStore.getState().drafts[key]).toBeUndefined();+ store.setDraft(key, "Keep reply");+ store.addAnnotation(key, annotation);+ store.updateAnnotation(key, annotation.id, " ");+ expect(store.getAnnotations(key)).toHaveLength(0);+ expect(store.getDraft(key)).toBe("Keep reply");+ expect(useCommentDraftStore.getState().drafts[key]?.replyTarget).toBeUndefined();+ });++ it("drops legacy empty annotations and their target when restoring a draft", async () => {+ const store = useCommentDraftStore.getState();+ store.setDraft(key, "Keep reply");+ store.addAnnotation(key, annotation);+ await flush();+ const saved = JSON.parse(localStorage.getItem("multica_comment_drafts:annotation-tests")!);+ saved.state.drafts[key].annotations[0].note = " ";+ localStorage.setItem("multica_comment_drafts:annotation-tests", JSON.stringify(saved));+ useCommentDraftStore.getState().drafts = {};+ await useCommentDraftStore.persist.rehydrate();+ expect(store.getAnnotations(key)).toHaveLength(0);+ expect(store.getDraft(key)).toBe("Keep reply");+ expect(useCommentDraftStore.getState().drafts[key]?.replyTarget).toBeUndefined();+ });+it("persists description annotations with the new comment draft without a reply target", async () => {const store = useCommentDraftStore.getState();store.setDraft("new:issue", "Existing draft");@@ -374,7 +401,7 @@ describe("reply annotations", () => {expect(store.addAnnotation(key, annotation)).toBe("a");const snapshot = useCommentDraftStore.getState().drafts[key];expect(store.addAnnotation(key, { ...annotation, id: "duplicate" })).toBe("a");- store.updateAnnotation(key, "a", "");+ store.updateAnnotation(key, "a", "A note");store.setDraft(key, "");expect(useCommentDraftStore.getState().drafts[key]).toBe(snapshot);store.updateAnnotation(key, "a", "New intent");diff --git a/packages/core/issues/stores/comment-draft-store.ts b/packages/core/issues/stores/comment-draft-store.tsindex 28e47cde1f..4cd86c94d9 100644--- a/packages/core/issues/stores/comment-draft-store.ts+++ b/packages/core/issues/stores/comment-draft-store.ts@@ -243,7 +243,7 @@ export const useCommentDraftStore = create<CommentDraftStore>()(}),getAnnotations: (key) => get().drafts[key]?.annotations ?? EMPTY_REPLY_ANNOTATIONS,addAnnotation: (key, annotation) => {- if ((!key.startsWith("reply:") && !key.startsWith("new:")) || !annotation.quote.trim() || annotation.quote.length > MAX_ANNOTATION_QUOTE_LENGTH) return undefined;+ if ((!key.startsWith("reply:") && !key.startsWith("new:")) || !annotation.note.trim() || !annotation.quote.trim() || annotation.quote.length > MAX_ANNOTATION_QUOTE_LENGTH) return undefined;const current = get().getAnnotations(key);const duplicate = current.find((a) => a.sourceCommentId === annotation.sourceCommentId &&a.start === annotation.start && a.quote === annotation.quote && a.prefix === annotation.prefix && a.suffix === annotation.suffix);@@ -260,7 +260,10 @@ export const useCommentDraftStore = create<CommentDraftStore>()(updateAnnotation: (key, id, note) => set((s) => {const current = s.drafts[key]?.annotations ?? EMPTY_REPLY_ANNOTATIONS;if (!current.some((a) => a.id === id && a.note !== note)) return s;- return { drafts: writeDraft(s.drafts, key, s.drafts[key]?.content ?? "", uploadsOf(s.drafts, key), current.map((a) => a.id === id ? { ...a, note } : a)) };+ const annotations = note.trim()+ ? current.map((a) => a.id === id ? { ...a, note } : a)+ : current.filter((a) => a.id !== id);+ return { drafts: writeDraft(s.drafts, key, s.drafts[key]?.content ?? "", uploadsOf(s.drafts, key), annotations) };}),removeAnnotation: (key, id) => set((s) => {const current = s.drafts[key]?.annotations ?? EMPTY_REPLY_ANNOTATIONS;diff --git a/packages/views/editor/bubble-menu.tsx b/packages/views/editor/bubble-menu.tsxindex 1acf85ab50..203058b9f4 100644--- a/packages/views/editor/bubble-menu.tsx+++ b/packages/views/editor/bubble-menu.tsx@@ -639,25 +639,6 @@ function EditorBubbleMenu({) : (<TooltipProvider delay={300}><div className="bubble-menu">- {selectionAction && <>- <Tooltip>- <TooltipTrigger render={- <button type="button" className={toggleVariants({ size: "sm" })}- aria-label={selectionAction.label}- onClick={() => {- if (selectionAction.onSelect() === false) return;- // Keep later editor transactions from reopening the formatting- // toolbar over the annotation's note field. The text is untouched.- editor.commands.setTextSelection(editor.state.selection.to);- setVisible(false);- }} />- }>- <MessageSquarePlus className="size-3.5" />- </TooltipTrigger>- <TooltipContent side="top" sideOffset={8}>{selectionAction.label}</TooltipContent>- </Tooltip>- {!fmt.codeBlock && <Separator orientation="vertical" className="mx-0.5 h-5" />}- </>}{!fmt.codeBlock && <><MarkButton editor={editor} mark="bold" icon={Bold} label={t(($) => $.bubble_menu.bold)} shortcut={createShortcutChord("B", { primary: true })} isActive={fmt.bold} /><MarkButton editor={editor} mark="italic" icon={Italic} label={t(($) => $.bubble_menu.italic)} shortcut={createShortcutChord("I", { primary: true })} isActive={fmt.italic} />@@ -722,6 +703,25 @@ function EditorBubbleMenu({</>)}</>}+ {selectionAction && <>+ {!fmt.codeBlock && <Separator orientation="vertical" className="mx-0.5 h-5" />}+ <Tooltip>+ <TooltipTrigger render={+ <button type="button" className={toggleVariants({ size: "sm" })}+ aria-label={selectionAction.label}+ onClick={() => {+ if (selectionAction.onSelect() === false) return;+ // Keep later editor transactions from reopening the formatting+ // toolbar over the annotation's note field. The text is untouched.+ editor.commands.setTextSelection(editor.state.selection.to);+ setVisible(false);+ }} />+ }>+ <MessageSquarePlus className="size-3.5" />+ </TooltipTrigger>+ <TooltipContent side="top" sideOffset={8}>{selectionAction.label}</TooltipContent>+ </Tooltip>+ </>}</div></TooltipProvider>)}diff --git a/packages/views/editor/readonly-content.test.tsx b/packages/views/editor/readonly-content.test.tsxindex 5fb8fff7c9..570bf1354e 100644--- a/packages/views/editor/readonly-content.test.tsx+++ b/packages/views/editor/readonly-content.test.tsx@@ -152,7 +152,7 @@ describe("ReadonlyContent annotated replies", () => {expect(quote.textContent?.replace(/\u00a0/g, " ").trim()).toBe(text);});- it.each(["A note", ""])("keeps a visible blank paragraph between annotations (note: %s)", (note) => {+ it.each(["A note", "A note\n\nWith another paragraph"])("keeps a visible blank paragraph between annotations (note: %s)", (note) => {const first = {id: "first", sourceCommentId: "source", sourceActorName: "Agent",quote: "First quote", note, start: 0, prefix: "", suffix: "",@@ -165,7 +165,10 @@ describe("ReadonlyContent annotated replies", () => {expect(quotes[1]?.previousElementSibling?.tagName).toBe("P");expect(quotes[1]?.previousElementSibling?.textContent).toBe("\u00a0");expect(container.querySelectorAll("p").length).toBeGreaterThan(2);- expect(container.querySelector("a, ol, hr")).toBeNull();+ expect(container.querySelector("a, ol")).toBeNull();+ expect(container.querySelectorAll("hr")).toHaveLength(1);+ expect(container.querySelector("hr")?.previousElementSibling?.textContent).toBe(note.split("\n\n").at(-1));+ expect(container.querySelector("hr")?.nextElementSibling?.textContent).toBe("Overall reply");});it("renders quote snapshots and notes without generated links or numbered lists", () => {diff --git a/packages/views/issues/components/comment-card-edit-gate.test.tsx b/packages/views/issues/components/comment-card-edit-gate.test.tsxindex 337f2d0a2f..6a8c7143a0 100644--- a/packages/views/issues/components/comment-card-edit-gate.test.tsx+++ b/packages/views/issues/components/comment-card-edit-gate.test.tsx@@ -394,8 +394,13 @@ describe("comment thread — selection reply", () => {fireEvent.mouseUp(source);fireEvent.click(source);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Comment (optional)" }), { target: { value: "Reply-specific note" } });- if (!keepNoteOpen) fireEvent.pointerDown(document.body);+ fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Reply-specific note" } });+ expect(useCommentDraftStore.getState().getAnnotations("reply:issue-1:comment-1")).toHaveLength(0);+ fireEvent.click(screen.getByRole("button", { name: "Add annotation" }));+ if (keepNoteOpen) {+ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Unconfirmed edit" } });+ }expect(container.querySelector('[data-annotation-thread="reply:issue-1:comment-1"]')).toHaveTextContent("1 annotation");expect(screen.queryByRole("button", { name: "Done" })).not.toBeInTheDocument();expect(screen.queryByRole("button", { name: "Preview reply" })).not.toBeInTheDocument();diff --git a/packages/views/issues/components/comment-composers.test.tsx b/packages/views/issues/components/comment-composers.test.tsxindex 71e2e3211e..c551e7bc3d 100644--- a/packages/views/issues/components/comment-composers.test.tsx+++ b/packages/views/issues/components/comment-composers.test.tsx@@ -1138,14 +1138,23 @@ describe.each(["reply", "description"])("annotations in %s drafts", (source) =>await waitFor(() => expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toHaveLength(0));});- it("keeps annotations on failure and blocks quote-only drafts until a note is entered", async () => {+ it("sends annotations above the composer body with a divider", async () => {+ useCommentDraftStore.getState().setDraft(draftKey, "Overall reply");+ useCommentDraftStore.getState().addAnnotation(draftKey, annotation);+ const onSubmit = vi.fn().mockResolvedValue("reply-new");+ renderAnnotatedComposer(onSubmit);+ fireEvent.click(screen.getByRole("button", { name: "Send" }));+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));+ expect(onSubmit.mock.calls[0]?.[0]).toBe("> Selected text\n\nPlease revise\n\n---\n\nOverall reply");+ });++ it("ignores empty selections and keeps saved annotations on send failure", async () => {useCommentDraftStore.getState().addAnnotation(draftKey, { ...annotation, note: "" });const onSubmit = vi.fn().mockResolvedValue(false);renderAnnotatedComposer(onSubmit);expect(screen.getByRole("button", { name: "Send" })).toBeDisabled();- fireEvent.click(screen.getByRole("button", { name: /1 annotation/ }));- expect(screen.queryByRole("textbox", { name: "Comment (optional)" })).not.toBeInTheDocument();- act(() => useCommentDraftStore.getState().updateAnnotation(draftKey, annotation.id, "New note"));+ expect(screen.queryByRole("button", { name: /1 annotation/ })).not.toBeInTheDocument();+ act(() => { useCommentDraftStore.getState().addAnnotation(draftKey, { ...annotation, note: "New note" }); });fireEvent.click(screen.getByRole("button", { name: "Send" }));await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));expect(useCommentDraftStore.getState().getAnnotations(draftKey)[0]?.note).toBe("New note");diff --git a/packages/views/issues/components/comment-selection-bubble.test.tsx b/packages/views/issues/components/comment-selection-bubble.test.tsxnew file mode 100644index 0000000000..ea0b04f533--- /dev/null+++ b/packages/views/issues/components/comment-selection-bubble.test.tsx@@ -0,0 +1,94 @@+import { render, screen, waitFor, cleanup } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { CommentSelectionBubble } from "./comment-selection-bubble";++beforeEach(() => {+ Object.defineProperty(document.documentElement, "clientWidth", { configurable: true, value: 1024 });+ Object.defineProperty(document.documentElement, "clientHeight", { configurable: true, value: 768 });+ vi.spyOn(HTMLElement.prototype, "offsetWidth", "get").mockReturnValue(24);+ vi.spyOn(HTMLElement.prototype, "offsetHeight", "get").mockReturnValue(24);+});+afterEach(() => { cleanup(); vi.restoreAllMocks(); });++function fixture(tops: number[], right = 1024) {+ const source = document.createElement("div");+ source.textContent = "Selected text";+ document.body.append(source);+ const geometry = { right, tops };+ vi.spyOn(source, "getBoundingClientRect").mockImplementation(() => new DOMRect(10, 10, geometry.right - 10, 700));+ const ranges = tops.map((_, i) => {+ const range = document.createRange();+ range.selectNodeContents(source);+ range.getBoundingClientRect = () => new DOMRect(10, geometry.tops[i], 120, 20);+ return range;+ });+ const view = render(<>{ranges.map((range, i) =>+ <CommentSelectionBubble key={i} range={range} source={source} owner="test" markerRanges={ranges}>+ <button>{i + 1}</button>+ </CommentSelectionBubble>,+ )}</>);+ return { geometry, source, dispose: () => { view.unmount(); source.remove(); } };+}++// Real Floating UI middleware, with only browser geometry supplied by jsdom.+describe("annotation marker layout", () => {+ it("keeps a visible quote's marker visible at the viewport's right edge", async () => {+ const { dispose } = fixture([100]);+ const marker = await screen.findByRole("button", { name: "1" });+ expect(marker).toBeVisible();+ expect(parseFloat(marker.parentElement!.style.left)).toBeLessThanOrEqual(992);+ dispose();+ });++ it("tracks range movement without a resize event and hides offscreen quotes", async () => {+ const { geometry, dispose } = fixture([100], 600);+ const marker = await screen.findByRole("button", { name: "1" });+ const overlay = marker.parentElement!;+ await waitFor(() => expect(overlay.style.top).toBe("100px"));+ geometry.tops[0] = 240;+ await waitFor(() => expect(overlay.style.top).toBe("240px"));+ geometry.tops[0] = -100;+ await waitFor(() => expect(marker).not.toBeVisible());+ geometry.tops[0] = 300;+ await waitFor(() => expect(marker).toBeVisible());+ dispose();+ });++ it("stacks nearby markers without clamping them onto each other at the bottom", async () => {+ const { dispose } = fixture([740, 741]);+ const first = await screen.findByRole("button", { name: "1" });+ const second = await screen.findByRole("button", { name: "2" });+ expect(parseFloat(second.parentElement!.style.top) - parseFloat(first.parentElement!.style.top)).toBe(28);+ dispose();+ });+});+++describe("annotation editor layout", () => {+ it("keeps the portaled editor inside its source scroll panel", async () => {+ const panel = document.createElement("div");+ panel.style.cssText = "position: relative; overflow: auto; width: 500px; height: 700px;";+ const source = document.createElement("div");+ source.textContent = "Selected text near the left edge";+ panel.append(source);+ document.body.append(panel);+ vi.spyOn(panel, "getBoundingClientRect").mockReturnValue(new DOMRect(400, 0, 500, 700));+ for (const [key, value] of Object.entries({ clientWidth: 500, clientHeight: 700, offsetWidth: 500, offsetHeight: 700 })) {+ Object.defineProperty(panel, key, { configurable: true, value });+ }+ vi.spyOn(source, "getBoundingClientRect").mockReturnValue(new DOMRect(420, 100, 460, 500));+ const range = document.createRange();+ range.selectNodeContents(source);+ range.getBoundingClientRect = () => new DOMRect(420, 100, 100, 20);+ vi.spyOn(HTMLElement.prototype, "offsetWidth", "get").mockReturnValue(320);+ const view = render(<CommentSelectionBubble range={range} source={source} owner="test">+ <textarea aria-label="Annotation note" />+ </CommentSelectionBubble>);+ try {+ const input = await screen.findByRole("textbox", { name: "Annotation note" });+ // Centering on the quote alone would put the editor at x=310, over+ // Inbox's list. Its reference clipping ancestors provide the boundary.+ await waitFor(() => expect(parseFloat(input.parentElement!.style.left)).toBe(408));+ } finally { view.unmount(); panel.remove(); }+ });+});diff --git a/packages/views/issues/components/comment-selection-bubble.tsx b/packages/views/issues/components/comment-selection-bubble.tsxindex 22a895921b..2cc5f9e061 100644--- a/packages/views/issues/components/comment-selection-bubble.tsx+++ b/packages/views/issues/components/comment-selection-bubble.tsx@@ -5,12 +5,14 @@ import { createPortal } from "react-dom";import { autoUpdate, computePosition, flip, hide, offset, shift } from "@floating-ui/dom";/** Match the description's EditorBubbleMenu geometry for readonly selections. */-export function CommentSelectionBubble({ range, source, children, owner, markerRanges }: {+export function CommentSelectionBubble({ range, source, children, owner, markerRanges, onPositioned }: {range: Range;source: HTMLElement;children: ReactNode;owner: string;markerRanges?: Range[];+ /** Called after the popup has a visible, usable position. */+ onPositioned?: () => void;}) {const ref = useRef<HTMLDivElement>(null);const marker = !!markerRanges;@@ -20,35 +22,48 @@ export function CommentSelectionBubble({ range, source, children, owner, markerRlet active = true;const anchor = {contextElement: source,- getBoundingClientRect: () => {- const rect = range.getBoundingClientRect();- if (!markerRanges) return rect;- // Stack nearby source markers so two quotes on one line remain clickable.- const sorted = markerRanges.map((item) => ({ item, top: item.getBoundingClientRect().top }))- .sort((a, b) => a.top - b.top);- let top = -Infinity;- for (const item of sorted) {- top = Math.max(top + 28, item.top);- if (item.item === range) break;- }- return new DOMRect(source.getBoundingClientRect().right, top, 0, 24);- },+ getBoundingClientRect: () => range.getBoundingClientRect(),};+ let revision = 0;const update = () => {+ const currentRevision = ++revision;+ // Keep visibility tied to the real quote, not a zero-width point outside+ // the scroll container. Markers move horizontally but never clamp/flip+ // vertically: doing so piles unrelated annotations at the viewport edge.computePosition(anchor, element, {strategy: "fixed",placement: marker ? "right-start" : "top",- middleware: [offset(marker ? 4 : 8), flip(), shift({ padding: 8 }), hide()],+ middleware: markerRanges ? [+ offset(({ rects }) => {+ const sorted = markerRanges.map((item) => ({ item, top: item.getBoundingClientRect().top }))+ .sort((a, b) => a.top - b.top);+ let top = -Infinity;+ for (const item of sorted) {+ top = Math.max(top + 28, item.top);+ if (item.item === range) break;+ }+ return {+ mainAxis: source.getBoundingClientRect().right - (rects.reference.x + rects.reference.width) + 4,+ crossAxis: top - rects.reference.y,+ };+ }),+ shift({ padding: 8, mainAxis: false, crossAxis: true }), hide(),+ ] : [offset(8), flip({ padding: 8, altBoundary: true }), shift({ padding: 8, altBoundary: true }), hide()],}).then(({ x, y, middlewareData }) => {- if (!active || !element.isConnected) return;- element.style.visibility = !source.isConnected || middlewareData.hide?.referenceHidden ? "hidden" : "visible";+ if (!active || currentRevision !== revision || !element.isConnected) return;+ const rect = range.getBoundingClientRect();+ element.style.visibility = !source.isConnected || !range.startContainer.isConnected ||+ (rect.width === 0 && rect.height === 0) || middlewareData.hide?.referenceHidden ? "hidden" : "visible";element.style.left = `${x}px`;element.style.top = `${y}px`;+ if (element.style.visibility === "visible") onPositioned?.();});};- const cleanup = autoUpdate(anchor, element, update);+ // Sidebar transitions and font/content reflow can move a Range without+ // resizing its source element or triggering a window resize.+ const cleanup = autoUpdate(anchor, element, update, { animationFrame: true });return () => { active = false; cleanup(); };- }, [range, source, marker, markerRanges]);+ }, [range, source, marker, markerRanges, onPositioned]);return createPortal(<div ref={ref} data-reply-annotation-overlay={owner}diff --git a/packages/views/issues/components/reply-annotations.tsx b/packages/views/issues/components/reply-annotations.tsxindex 7c47bcffff..b033ba3988 100644--- a/packages/views/issues/components/reply-annotations.tsx+++ b/packages/views/issues/components/reply-annotations.tsx@@ -36,6 +36,7 @@ export function ReplyAnnotations({ draftKey, annotations, disabled, onEditAnnotaonClick={(event) => event.stopPropagation()}><div className="flex max-h-64 flex-col gap-2 overflow-y-auto">{annotations.map((annotation, index) => <div key={annotation.id} className="flex items-start gap-1">+ <span aria-hidden="true" className="mt-1 flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-caption tabular-nums">{index + 1}</span><div className="min-w-0 flex-1"><button type="button" disabled={disabled}aria-label={t(($) => $.reply.annotations.edit, { number: index + 1 })}diff --git a/packages/views/issues/components/use-comment-annotations.test.tsx b/packages/views/issues/components/use-comment-annotations.test.tsxindex f0a7172b80..b7c5116168 100644--- a/packages/views/issues/components/use-comment-annotations.test.tsx+++ b/packages/views/issues/components/use-comment-annotations.test.tsx@@ -84,6 +84,28 @@ describe("selection to reply", () => {expect(onRender).toHaveBeenCalledTimes(count);});+ it.each([false, true])("focuses the note only after its popup is visible (description: %s)", async (description) => {+ vi.spyOn(window, "matchMedia").mockReturnValue({ matches: true } as MediaQueryList);+ const visibilityAtFocus: string[] = [];+ vi.spyOn(HTMLTextAreaElement.prototype, "focus").mockImplementation(function (this: HTMLTextAreaElement, options) {+ visibilityAtFocus.push((this.closest("[data-reply-annotation-overlay]") as HTMLElement).style.visibility);+ HTMLElement.prototype.focus.call(this, options);+ });+ const { container } = renderWithI18n(description ? <DescriptionFixture /> : <Fixture />);+ selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: description ? "Add to comment" : "Add to reply" }));+ const input = await screen.findByRole("textbox", { name: "Comment" });+ await waitFor(() => expect(input).toHaveFocus());+ expect(visibilityAtFocus).toEqual(["visible"]);+ fireEvent.change(input, { target: { value: "A note" } });+ const confirm = await screen.findByRole("button", { name: "Add annotation" });+ confirm.focus();+ await act(async () => {});+ expect(confirm).toHaveFocus();+ expect(visibilityAtFocus).toEqual(["visible"]);+ vi.restoreAllMocks();+ });+it("reports an uncapturable description selection without adding a draft", () => {renderWithI18n(<DescriptionFixture />);window.getSelection()?.removeAllRanges();@@ -104,7 +126,7 @@ describe("selection to reply", () => {const { container } = renderWithI18n(description ? <DescriptionFixture /> : <Fixture />);const source = container.querySelector<HTMLElement>(description ? "[contenteditable]" : "[data-comment-content]")!;fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));- expect(await screen.findByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Note first");+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Note first");const remove = screen.getByRole("button", { name: "Remove annotation 1" });fireEvent.pointerDown(remove);fireEvent.click(remove);@@ -116,7 +138,7 @@ describe("selection to reply", () => {expect(screen.queryByRole("button", { name: "Edit annotation 2" })).not.toBeInTheDocument();fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));- expect(await screen.findByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Note second");+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Note second");fireEvent.click(screen.getByRole("button", { name: "Remove annotation 1" }));await waitFor(() => expect(screen.queryByRole("button", { name: "Edit annotation 1" })).not.toBeInTheDocument());expect(store.getAnnotations(draftKey)).toHaveLength(0);@@ -131,19 +153,20 @@ describe("selection to reply", () => {const { rerender } = renderWithI18n(<DescriptionFixture loaded={false} />);rerender(<DescriptionFixture />);fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));- expect(await screen.findByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Saved note");+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Saved note");});it("captures editable descriptions into a new thread draft and clears the popup on issue switch", async () => {const { container, rerender } = renderWithI18n(<DescriptionFixture />);selectText(container);expect(screen.queryByRole("button", { name: "Add to reply" })).not.toBeInTheDocument();fireEvent.click(screen.getByRole("button", { name: "Add to comment" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Comment (optional)" }), { target: { value: "Question about description" } });+ fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Question about description" } });+ fireEvent.click(screen.getByRole("button", { name: "Add annotation" }));expect(useCommentDraftStore.getState().getAnnotations("new:issue")[0]).toMatchObject({ quote: "Selected text", note: "Question about description" });expect(useCommentDraftStore.getState().drafts["new:issue"]?.replyTarget).toBeUndefined();expect(container.querySelector("[contenteditable]")).toHaveTextContent("Selected text");rerender(<DescriptionFixture issueId="other" />);- await waitFor(() => expect(screen.queryByRole("textbox", { name: "Comment (optional)" })).not.toBeInTheDocument());+ await waitFor(() => expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument());expect(useCommentDraftStore.getState().getAnnotations("new:other")).toHaveLength(0);expect(useCommentDraftStore.getState().getAnnotations("new:issue")).toHaveLength(1);});@@ -151,30 +174,105 @@ describe("selection to reply", () => {const view = renderWithI18n(<Fixture />);selectText(view.container);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Comment (optional)" }), { target: { value: "Keep this note" } });- view.rerender(<Fixture sourceKey="expanded" />);- await waitFor(() => expect(screen.getByRole("textbox", { name: "Comment (optional)" })).toBeVisible());- expect(screen.getByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Keep this note");+ fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Keep this note" } });+ await act(async () => { view.rerender(<Fixture sourceKey="expanded" />); });+ await waitFor(() => expect(screen.getByRole("textbox", { name: "Comment" })).toBeVisible());+ expect(screen.getByRole("textbox", { name: "Comment" })).toHaveValue("Keep this note");});- it("saves before typing, autosaves the note, and reopens duplicates without erasing it", async () => {+ it("waits for explicit confirmation and reopens duplicates without erasing the saved note", async () => {const { container } = renderWithI18n(<Fixture />);selectText(container);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const note = await screen.findByRole("textbox", { name: "Comment (optional)" });- expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(1);+ const note = await screen.findByRole("textbox", { name: "Comment" });+ expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(0);fireEvent.change(note, { target: { value: "Please explain" } });- expect(screen.queryByRole("button", { name: "Done" })).not.toBeInTheDocument();+ expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(0);+ fireEvent.click(screen.getByRole("button", { name: "Add annotation" }));fireEvent.pointerDown(document.body);await waitFor(() => expect(screen.queryByRole("textbox")).not.toBeInTheDocument());selectText(container);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- expect(await screen.findByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Please explain");+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Please explain");expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(1);fireEvent.keyDown(screen.getByRole("textbox"), { key: "Escape" });await waitFor(() => expect(screen.queryByRole("textbox")).not.toBeInTheDocument());expect(useCommentDraftStore.getState().getAnnotations(key)[0]?.note).toBe("Please explain");fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));- expect(await screen.findByRole("textbox", { name: "Comment (optional)" })).toHaveValue("Please explain");+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Please explain");+ });++ it.each([false, true])("confirms changes and cancels unsaved edits (description: %s)", async (description) => {+ const draftKey = description ? "new:issue" as const : key;+ const { container } = renderWithI18n(description ? <DescriptionFixture /> : <Fixture />);+ selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: description ? "Add to comment" : "Add to reply" }));+ const input = await screen.findByRole("textbox", { name: "Comment" });+ const confirm = screen.getByRole("button", { name: "Add annotation" });+ expect(confirm).toBeDisabled();+ fireEvent.change(input, { target: { value: " " } });+ expect(confirm).toBeDisabled();+ fireEvent.change(input, { target: { value: "Unsaved note" } });+ fireEvent.pointerDown(document.body);+ expect(useCommentDraftStore.getState().drafts[draftKey]).toBeUndefined();++ selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: description ? "Add to comment" : "Add to reply" }));+ const reopened = await screen.findByRole("textbox", { name: "Comment" });+ expect(reopened).toHaveValue("");+ fireEvent.change(reopened, { target: { value: "A real note" } });+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toHaveLength(0);+ expect(screen.queryByRole("button", { name: "Edit annotation 1" })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Add annotation" }));+ expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument();+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)[0]?.note).toBe("A real note");++ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ const edit = await screen.findByRole("textbox", { name: "Comment" });+ fireEvent.change(edit, { target: { value: "" } });+ expect(screen.getByRole("button", { name: "Save annotation" })).toBeDisabled();+ fireEvent.change(edit, { target: { value: "Unconfirmed change" } });+ fireEvent.keyDown(edit, { key: "Escape" });+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)[0]?.note).toBe("A real note");+ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("A real note");+ fireEvent.change(screen.getByRole("textbox", { name: "Comment" }), { target: { value: "Replacement" } });+ fireEvent.click(screen.getByRole("button", { name: "Save annotation" }));+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)[0]?.note).toBe("Replacement");+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toHaveLength(1);+ });++ it.each([false, true])("uses Enter to confirm and Shift + Enter for newlines (description: %s)", async (description) => {+ const draftKey = description ? "new:issue" as const : key;+ const { container } = renderWithI18n(description ? <DescriptionFixture /> : <Fixture />);+ selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: description ? "Add to comment" : "Add to reply" }));+ const input = await screen.findByRole("textbox", { name: "Comment" });+ fireEvent.keyDown(input, { key: "Enter" });+ expect(input).toBeInTheDocument();+ fireEvent.change(input, { target: { value: "First line" } });+ expect(fireEvent.keyDown(input, { key: "Enter", shiftKey: true })).toBe(true);+ expect(input).toBeInTheDocument();+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toHaveLength(0);+ fireEvent.keyDown(input, { key: "Enter", isComposing: true });+ // Safari's composition commit can clear isComposing before keydown.+ fireEvent.keyDown(input, { key: "Enter", keyCode: 229 });+ expect(input).toBeInTheDocument();+ fireEvent.change(input, { target: { value: "First line\nSecond line" } });+ fireEvent.keyDown(input, { key: "Enter" });+ expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument();+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)[0]?.note).toBe("First line\nSecond line");+ });++ it("reattaches the open editor when only the source text node is replaced", async () => {+ const { container } = renderWithI18n(<Fixture />);+ const source = selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));+ fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Keep note" } });+ await act(async () => { source.replaceChildren(document.createTextNode("Selected text")); });+ expect(await screen.findByRole("textbox", { name: "Comment" })).toHaveValue("Keep note");+ expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(0);+ fireEvent.click(screen.getByRole("button", { name: "Add annotation" }));+ expect(await screen.findByRole("button", { name: "Edit annotation 1" })).toBeVisible();});it("offers annotations on member comments", async () => {diff --git a/packages/views/issues/components/use-comment-annotations.tsx b/packages/views/issues/components/use-comment-annotations.tsxindex d46bdf0f87..ad3861d073 100644--- a/packages/views/issues/components/use-comment-annotations.tsx+++ b/packages/views/issues/components/use-comment-annotations.tsx@@ -3,9 +3,10 @@import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";import { MessageSquarePlus, Trash2 } from "lucide-react";import { toast } from "sonner";+import { isImeComposing } from "@multica/core/utils";import { Button } from "@multica/ui/components/ui/button";import { useCommentDraftStore, type CommentDraftKey } from "@multica/core/issues/stores";-import { MAX_ANNOTATION_QUOTE_LENGTH, MAX_REPLY_ANNOTATIONS } from "@multica/core/drafts/reply-annotation";+import { MAX_ANNOTATION_QUOTE_LENGTH, MAX_REPLY_ANNOTATIONS, type ReplyAnnotation } from "@multica/core/drafts/reply-annotation";import { useT } from "../../i18n";import { annotationRange, captureCommentSelection, findAnnotationSource } from "./comment-annotation-selection";import { CommentSelectionBubble } from "./comment-selection-bubble";@@ -24,9 +25,15 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, ediconst { t } = useT("issues");const cardRef = useRef<HTMLDivElement>(null);const inputRef = useRef<HTMLTextAreaElement>(null);+ const pendingFocusId = useRef<string | null>(null);const actionRef = useRef<HTMLButtonElement>(null);const [selection, setSelection] = useState<CapturedSelection | null>(null);- const [editingId, setEditingId] = useState<string | null>(null);+ const [editor, setEditor] = useState<{ annotation: ReplyAnnotation; existing: boolean } | null>(null);+ const editing = editor?.annotation;+ const editingExisting = editor?.existing === true;+ const editingRef = useRef(editing);+ editingRef.current = editing;+ const editingId = editing?.id;const [error, setError] = useState(false);const [anchors, setAnchors] = useState<SourceAnchor[]>([]);const markerRanges = useMemo(() => {@@ -45,7 +52,6 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, ediconst onAddedRef = useRef(onAdded);onAddedRef.current = onAdded;const anchorKey = annotations.map((a) => a.id).join(",");- const editing = annotations.find((a) => a.id === editingId);const highlightName = `reply-annotation-${useId().replace(/[^a-zA-Z0-9-]/g, "")}`;const close = (restoreFocus = false) => {@@ -53,7 +59,7 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, ediconst target = editable ? selection.root.querySelector<HTMLElement>("[contenteditable=true]") ?? selection.root : selection.root;target.focus({ preventScroll: true });}- setSelection(null); setEditingId(null); setError(false);+ setSelection(null); setEditor(null); setError(false);};const readSelection = useCallback(() => {if (!enabled || !cardRef.current) return null;@@ -62,10 +68,10 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi}, [enabled, editable]);const capture = () => {const captured = readSelection();- if (captured) { setSelection(captured); setEditingId(null); setError(false); }+ if (captured) { setSelection(captured); setEditor(null); setError(false); }};- useEffect(() => { setSelection(null); setEditingId(null); setError(false); }, [draftKey]);+ useEffect(() => { setSelection(null); setEditor(null); setError(false); }, [draftKey, enabled]);// Dismiss on the next press, never on the click completing the opening drag.useEffect(() => {@@ -73,17 +79,20 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, ediconst onPointerDown = (event: PointerEvent) => {if (event.target instanceof Element &&event.target.closest("[data-reply-annotation-overlay]")?.getAttribute("data-reply-annotation-overlay") === draftKey) return;- setSelection(null); setEditingId(null); setError(false);+ setSelection(null); setEditor(null); setError(false);};const onKeyDown = (event: KeyboardEvent) => {- if (event.key !== "Escape") return;- if (selection.root.isConnected) selection.root.focus({ preventScroll: true });- setSelection(null); setEditingId(null); setError(false);+ if (event.key !== "Escape" || isImeComposing(event)) return;+ if (selection.root.isConnected) {+ const target = editable ? selection.root.querySelector<HTMLElement>("[contenteditable=true]") ?? selection.root : selection.root;+ target.focus({ preventScroll: true });+ }+ setSelection(null); setEditor(null); setError(false);};const onFocusIn = (event: FocusEvent) => {if (!(event.target instanceof Element) || selection.root.contains(event.target) ||event.target.closest("[data-reply-annotation-overlay]")?.getAttribute("data-reply-annotation-overlay") === draftKey) return;- setSelection(null); setEditingId(null); setError(false);+ setSelection(null); setEditor(null); setError(false);};document.addEventListener("pointerdown", onPointerDown);document.addEventListener("keydown", onKeyDown);@@ -93,18 +102,20 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edidocument.removeEventListener("keydown", onKeyDown);document.removeEventListener("focusin", onFocusIn);};- }, [selection, draftKey]);+ }, [selection, draftKey, editable]);- useEffect(() => {- if (editingId && window.matchMedia("(pointer: fine)").matches) inputRef.current?.focus({ preventScroll: true });+ const focusNote = useCallback(() => {+ if (!editingId || pendingFocusId.current !== editingId) return;+ pendingFocusId.current = null;+ if (window.matchMedia("(pointer: fine)").matches) inputRef.current?.focus({ preventScroll: true });}, [editingId]);useEffect(() => {- if (!anchorKey) {+ if ((!anchorKey && !editingId) || !enabled) {setAnchors((current) => current.length ? [] : current);return;}- if (!enabled || !cardRef.current) return;+ if (!cardRef.current) return;const card = cardRef.current;const canHighlight = typeof Highlight !== "undefined" && typeof CSS !== "undefined" && !!CSS.highlights;const update = () => {@@ -117,11 +128,19 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi// Expanding a resolved thread may remount the selected comment's body.// Keep the note editor attached to its saved quote, never a detached Range.setSelection((current) => {- if (!current || current.root.isConnected) return current;+ if (!current) return current;const saved = annotationsRef.current.find((a) => a.sourceCommentId === current.sourceCommentId &&a.start === current.start && a.quote === current.quote);const anchor = saved && next.find((a) => a.id === saved.id);- return anchor ? { ...current, root: anchor.root, range: anchor.range } : null;+ if (anchor) return { ...current, root: anchor.root, range: anchor.range };+ const pending = editingRef.current;+ if (!saved && pending?.sourceCommentId === current.sourceCommentId) {+ const root = findAnnotationSource(card, pending.sourceCommentId);+ const range = root && annotationRange(root, pending, editable);+ return root && range ? { ...current, root, range } : null;+ }+ if (saved) return null;+ return current.root.isConnected && current.range.startContainer.isConnected ? current : null;});if (canHighlight) CSS.highlights.set(highlightName, new Highlight(...next.map((a) => a.range)));};@@ -137,11 +156,13 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi});observer.observe(card, { childList: true, subtree: true, characterData: true });return () => { observer.disconnect(); if (canHighlight) CSS.highlights.delete(highlightName); };- }, [anchorKey, highlightName, draftKey, editable, enabled]);+ }, [anchorKey, highlightName, draftKey, editable, enabled, editingId]);useEffect(() => {- if (editingId && !editing) { setSelection(null); setEditingId(null); }- }, [editingId, editing]);+ if (!selection || (editor?.existing && !annotations.some((a) => a.id === editingId))) {+ setSelection(null); setEditor(null);+ }+ }, [annotations, editor?.existing, editingId, selection]);const editAnnotation = (id: string, scrollToSource = false): boolean => {const annotation = annotationsRef.current.find((a) => a.id === id);@@ -152,7 +173,8 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, ediconst element = range.startContainer instanceof Element ? range.startContainer : range.startContainer.parentElement;element?.scrollIntoView({ block: "center", behavior: "instant" });}- setSelection({ ...annotation, range, root }); setEditingId(id); setError(false);+ pendingFocusId.current = id;+ setSelection({ ...annotation, range, root }); setEditor({ annotation, existing: true }); setError(false);return true;};@@ -163,27 +185,50 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edireturn false;}const { quote, start, prefix, suffix, sourceCommentId } = captured;- const id = useCommentDraftStore.getState().addAnnotation(draftKey, {- id: crypto.randomUUID(), sourceCommentId,- sourceActorName: source.name,- sourceRevision: source.revision, quote, start, prefix, suffix, note: "",- });- if (!id) {+ const duplicate = annotationsRef.current.find((a) => a.sourceCommentId === sourceCommentId &&+ a.start === start && a.quote === quote && a.prefix === prefix && a.suffix === suffix);+ if (quote.length > MAX_ANNOTATION_QUOTE_LENGTH || (!duplicate && annotationsRef.current.length >= MAX_REPLY_ANNOTATIONS)) {setError(true);- toast.error(captured.quote.length > MAX_ANNOTATION_QUOTE_LENGTH+ toast.error(quote.length > MAX_ANNOTATION_QUOTE_LENGTH? t(($) => $.reply.annotations.quote_limit, { count: MAX_ANNOTATION_QUOTE_LENGTH }): t(($) => $.reply.annotations.count_limit, { count: MAX_REPLY_ANNOTATIONS }));return false;}setSelection(captured);- setEditingId(id);+ const next = duplicate ?? {+ id: crypto.randomUUID(), sourceCommentId, sourceActorName: source.name,+ sourceRevision: source.revision, quote, start, prefix, suffix, note: "",+ };+ pendingFocusId.current = next.id;+ setEditor({ annotation: next, existing: !!duplicate });setError(false);window.getSelection()?.removeAllRanges();- onAddedRef.current?.();return true;- }, [draftKey, t]);+ }, [t]);const addSelection = useCallback(() => add(readSelection()), [add, readSelection]);+ const confirmNote = () => {+ if (!editing?.note.trim()) return;+ const store = useCommentDraftStore.getState();+ if (editingExisting) store.updateAnnotation(draftKey, editing.id, editing.note);+ else if (!store.addAnnotation(draftKey, editing)) {+ setError(true);+ return;+ }+ close(true);+ if (!editingExisting) onAddedRef.current?.();+ };++ // Keep the pending quote identifiable without counting it as an annotation.+ useEffect(() => {+ if (!enabled || !selection || !editingId || typeof Highlight === "undefined" ||+ typeof CSS === "undefined" || !CSS.highlights) return;+ const name = `${highlightName}-selection`;+ CSS.highlights.set(name, new Highlight(selection.range));+ return () => { CSS.highlights.delete(name); };+ }, [enabled, selection, editingId, highlightName]);+ const confirmLabel = t(($) => editor?.existing ? $.reply.annotations.save : $.reply.annotations.confirm_add);+return {cardRef,editAnnotation,@@ -205,37 +250,49 @@ export function useCommentAnnotations({ draftKey, sources, enabled, onAdded, edi},},popup: <>- {annotations.length > 0 && <style>{`::highlight(${highlightName}) { background: color-mix(in srgb, var(--brand) 20%, transparent); }`}</style>}+ {(annotations.length > 0 || editing) && <style>{`::highlight(${highlightName}), ::highlight(${highlightName}-selection) { background: color-mix(in srgb, var(--brand) 20%, transparent); }`}</style>}{enabled && anchors.map((anchor) => {const index = annotations.findIndex((a) => a.id === anchor.id);if (index < 0) return null;return <CommentSelectionBubble key={anchor.id} range={anchor.range} source={anchor.root} owner={draftKey}markerRanges={markerRanges.get(anchor.root)}>- <Button variant="brandSubtle" size="icon-sm" className="size-6 rounded-full text-caption"+ <Button variant="brandSubtle" size="icon-sm" className="size-6 rounded-full text-caption tabular-nums aria-expanded:ring-2 aria-expanded:ring-brand"+ aria-expanded={editingId === anchor.id}aria-label={t(($) => $.reply.annotations.edit, { number: index + 1 })}onClick={() => editAnnotation(anchor.id)}>{index + 1}</Button></CommentSelectionBubble>;})}- {enabled && selection && <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey}>- <div className="bubble-menu max-w-[calc(100vw-16px)]">- {editing ? <><textarea ref={inputRef} value={editing.note} rows={Math.min(4, Math.max(1, editing.note.split("\n").length))}+ {enabled && selection && <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote}>+ <div className="bubble-menu max-w-[calc(100vw-16px)] focus-within:outline-1 focus-within:outline-ring">+ {editing ? <div className="flex w-80 max-w-[calc(100vw-26px)] flex-col gap-1"><textarea ref={inputRef} value={editing.note} rows={Math.min(4, Math.max(1, editing.note.split("\n").length))}aria-label={t(($) => $.reply.annotations.note_label)}placeholder={t(($) => $.reply.annotations.note_placeholder)}- className="min-h-8 w-72 min-w-0 resize-none rounded-sm bg-transparent px-2 py-1 text-body outline-none placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring"- onChange={(event) => useCommentDraftStore.getState().updateAnnotation(draftKey, editing.id, event.target.value)}+ className="min-h-8 max-h-[calc(4lh+0.75rem)] w-full min-w-0 resize-none field-sizing-content rounded-sm bg-transparent px-2 py-1.5 text-body outline-none placeholder:text-muted-foreground"+ onChange={(event) => {+ setEditor({ annotation: { ...editing, note: event.target.value }, existing: editingExisting });+ setError(false);+ }}onKeyDown={(event) => {- if (event.key === "Enter" && !event.nativeEvent.isComposing && !event.shiftKey && !event.metaKey && !event.ctrlKey) {- event.preventDefault(); close(true);+ if (event.key === "Enter" && !isImeComposing(event) &&+ !event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey) {+ event.preventDefault(); event.stopPropagation(); confirmNote();+ } else if (event.key === "Escape" && !isImeComposing(event)) {+ event.preventDefault(); event.stopPropagation(); close(true);}}} />- <Button variant="ghost" size="icon-sm" className="self-start text-muted-foreground hover:text-destructive"- aria-label={t(($) => $.reply.annotations.remove, { number: annotations.indexOf(editing) + 1 })}- title={t(($) => $.reply.annotations.remove, { number: annotations.indexOf(editing) + 1 })}- onClick={() => {- useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);- close(true);- }}><Trash2 /></Button>- </> : <Button ref={actionRef} variant="ghost" size="sm"+ <div className="flex items-center justify-end gap-1 px-1 pb-1">+ {editingExisting && <Button variant="ghost" size="icon-sm" className="mr-auto text-muted-foreground hover:text-destructive"+ aria-label={t(($) => $.reply.annotations.remove, { number: annotations.findIndex((a) => a.id === editing.id) + 1 })}+ title={t(($) => $.reply.annotations.remove, { number: annotations.findIndex((a) => a.id === editing.id) + 1 })}+ onClick={() => {+ useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);+ close(true);+ }}><Trash2 /></Button>}+ <Button size="sm" disabled={!editing.note.trim()}+ aria-label={confirmLabel} title={confirmLabel} aria-keyshortcuts="Enter"+ onClick={confirmNote}>{confirmLabel}</Button>+ </div>+ </div> : <Button ref={actionRef} variant="ghost" size="sm"onMouseDown={(event) => event.preventDefault()} onClick={() => add(selection)}><MessageSquarePlus />{t(($) => editable ? $.reply.annotations.add_comment : $.reply.annotations.add)}</Button>}diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex f4fa793574..a21b331d69 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -571,9 +571,11 @@"reply": {"placeholder": "Leave a reply...","annotations": {+ "confirm_add": "Add annotation",+ "save": "Save annotation","add_comment": "Add to comment","add": "Add to reply",- "note_label": "Comment (optional)",+ "note_label": "Comment","count_one": "{{count}} annotation","count_other": "{{count}} annotations","quote_limit": "Select up to {{count}} characters at a time.",@@ -585,7 +587,7 @@"selection_failed": "Could not capture the selection. Select text within one comment or description and try again.","source_label": "Comment by {{name}}","edit": "Edit annotation {{number}}",- "note_placeholder": "Add an optional comment…"+ "note_placeholder": "Add a comment…"}},"agent_activity": {diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex dbaf537cec..1f13d69e58 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -556,9 +556,11 @@"reply": {"placeholder": "返信を残す...","annotations": {+ "confirm_add": "注釈を追加",+ "save": "注釈を保存","add_comment": "コメントに追加","add": "返信に追加",- "note_label": "コメント(任意)",+ "note_label": "コメント","count_other": "{{count}} 件の注釈","quote_limit": "一度に選択できるのは {{count}} 文字までです。","count_limit": "コメントに追加できる注釈は {{count}} 件までです。",@@ -569,7 +571,7 @@"selection_failed": "選択範囲を取得できませんでした。同じコメントまたは説明の中で文字を選び直してください。","source_label": "{{name}} のコメント","edit": "注釈 {{number}} を編集",- "note_placeholder": "コメントを追加(任意)…"+ "note_placeholder": "コメントを追加…"}},"agent_activity": {diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 0e9d6500e4..6efc5856fd 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -556,9 +556,11 @@"reply": {"placeholder": "답글 남기기...","annotations": {+ "confirm_add": "주석 추가",+ "save": "주석 저장","add_comment": "댓글에 추가","add": "답글에 추가",- "note_label": "코멘트 (선택 사항)",+ "note_label": "코멘트","count_other": "주석 {{count}}개","quote_limit": "한 번에 최대 {{count}}자까지 선택할 수 있습니다.","count_limit": "댓글에 주석을 최대 {{count}}개까지 추가할 수 있습니다.",@@ -569,7 +571,7 @@"selection_failed": "선택한 텍스트를 가져오지 못했습니다. 같은 댓글이나 설명 안에서 텍스트를 다시 선택하세요.","source_label": "{{name}}의 댓글","edit": "주석 {{number}} 편집",- "note_placeholder": "의견 추가 (선택 사항)…"+ "note_placeholder": "의견 추가…"}},"agent_activity": {diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex 2e12fe99c9..30e5978678 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -556,9 +556,11 @@"reply": {"placeholder": "回复...","annotations": {+ "confirm_add": "添加批注",+ "save": "保存批注","add_comment": "加入评论","add": "加入回复",- "note_label": "批注(可选)",+ "note_label": "批注","count_other": "{{count}} 条批注","quote_limit": "每次最多选择 {{count}} 个字符。","count_limit": "一条评论最多包含 {{count}} 条批注。",@@ -569,7 +571,7 @@"selection_failed": "未能获取选中文字。请在同一条评论或任务描述内重新选择后再试。","source_label": "{{name}} 的评论","edit": "编辑批注 {{number}}",- "note_placeholder": "添加意见(可选)…"+ "note_placeholder": "添加意见..."}},"agent_activity": {