Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8702: unify annotation saves and whole-draft sends (#10165)
Multica Eve343f3df8a7d2
diff --git a/apps/docs/content/docs/comments.fr.mdx b/apps/docs/content/docs/comments.fr.mdxindex 21dbae4cc3..efab4ac1ac 100644--- a/apps/docs/content/docs/comments.fr.mdx+++ b/apps/docs/content/docs/comments.fr.mdx@@ -50,7 +50,7 @@ Pour les annotations de commentaire, la première que vous enregistrez fixe la c<Accordion title="Modifier, supprimer et raccourcis" id="annotation-editing">- Après avoir modifié une annotation existante, cliquez sur **Enregistrer l'annotation** pour appliquer le changement.-- Entrée confirme ; Maj + Entrée insère un saut de ligne. Échap ou un clic à l'extérieur annule les modifications non confirmées.+- Dans l’éditeur d’annotation, Entrée ajoute ou enregistre l’annotation ; Maj + Entrée insère un saut de ligne. Cmd + Entrée (macOS) ou Ctrl + Entrée (Windows/Linux) enregistre l’annotation actuelle et envoie tout le brouillon, y compris les annotations enregistrées, le texte et les pièces jointes. Ces touches ne dépendent pas de votre raccourci d’envoi personnel. Échap ou un clic à l’extérieur annule les modifications non confirmées.- Cliquez sur le marqueur numéroté dans le texte source pour modifier à nouveau la note. Le bouton corbeille à côté de la note supprime l'annotation, son marqueur et son entrée dans le brouillon.- Survoler le compteur d'annotations ouvre un panneau où vous pouvez consulter ou retirer les citations, ou cliquer sur une citation pour revenir à la source et modifier sa note. Ce panneau s'ouvre aussi d'un clic ou au clavier.diff --git a/apps/docs/content/docs/comments.ja.mdx b/apps/docs/content/docs/comments.ja.mdxindex 433d623b79..f76de22cfc 100644--- a/apps/docs/content/docs/comments.ja.mdx+++ b/apps/docs/content/docs/comments.ja.mdx@@ -50,7 +50,7 @@ Web と Desktop では、投稿済みのコメント(自分のコメントを<Accordion title="編集・削除とショートカット" id="annotation-editing">- 既存の注釈を編集したら、**注釈を保存** を押すと変更が反映されます。-- Enter で確定、Shift + Enter で改行します。Esc または入力欄の外をクリックすると、未確定の変更を取り消します。+- 注釈の入力欄では、Enter で注釈を追加・保存し、Shift + Enter で改行します。Cmd + Enter(macOS)または Ctrl + Enter(Windows/Linux)で現在の注釈を保存し、保存済みの注釈、本文、添付ファイルを含む下書き全体を送信します。このキー操作は送信ショートカットの個人設定に左右されません。Esc または入力欄の外をクリックすると、未確定の変更を取り消します。- 原文の番号をクリックすると再編集できます。入力欄の横のごみ箱ボタンを押すと、その注釈、原文のマーク、下書きの項目がまとめて削除されます。- 注釈件数にマウスを重ねるとポップアップが開き、引用の確認や削除ができます。引用をクリックすると原文の位置に戻って意見を編集できます。クリックやキーボードでもポップアップを開けます。diff --git a/apps/docs/content/docs/comments.ko.mdx b/apps/docs/content/docs/comments.ko.mdxindex aa108d96ad..af1574494d 100644--- a/apps/docs/content/docs/comments.ko.mdx+++ b/apps/docs/content/docs/comments.ko.mdx@@ -50,7 +50,7 @@ Web과 Desktop에서는 게시된 댓글(본인 댓글 포함)의 텍스트를<Accordion title="편집, 삭제, 단축키" id="annotation-editing">- 기존 주석을 편집한 뒤에는 **주석 저장**을 눌러야 변경이 적용됩니다.-- Enter는 확정, Shift + Enter는 줄바꿈입니다. Esc를 누르거나 입력란 밖을 클릭하면 확정하지 않은 변경이 취소됩니다.+- 주석 입력란에서 Enter는 주석 추가 또는 저장, Shift + Enter는 줄바꿈입니다. Cmd + Enter(macOS) 또는 Ctrl + Enter(Windows/Linux)는 현재 주석을 저장하고, 저장된 주석과 본문, 첨부 파일을 포함한 초안 전체를 보냅니다. 이 키 조합은 개인 전송 단축키 설정의 영향을 받지 않습니다. Esc를 누르거나 입력란 밖을 클릭하면 확정하지 않은 변경이 취소됩니다.- 원문의 번호 표시를 누르면 다시 편집할 수 있습니다. 입력란 옆의 휴지통 버튼을 누르면 해당 주석, 원문 표시, 초안 항목이 함께 삭제됩니다.- 주석 개수에 마우스를 올리면 팝업이 열리고, 인용문을 확인하거나 삭제하거나, 인용문을 눌러 원래 위치로 돌아가 의견을 편집할 수 있습니다. 클릭이나 키보드로도 팝업을 열 수 있습니다.diff --git a/apps/docs/content/docs/comments.mdx b/apps/docs/content/docs/comments.mdxindex 145e1078ca..cbf7f7e640 100644--- a/apps/docs/content/docs/comments.mdx+++ b/apps/docs/content/docs/comments.mdx@@ -50,7 +50,7 @@ For comment annotations, the first one you save fixes the reply target, includin<Accordion title="Editing, removing, and shortcuts" id="annotation-editing">- After editing an existing annotation, click **Save annotation** to apply the change.-- Enter confirms; Shift + Enter inserts a newline. Escape or clicking outside cancels unconfirmed changes.+- In the annotation editor, Enter adds or saves an annotation; Shift + Enter inserts a newline. Cmd + Enter (macOS) or Ctrl + Enter (Windows/Linux) saves the current annotation and sends the entire draft, including saved annotations, body text, and attachments. These keys do not follow your Send shortcut preference. Escape or clicking outside cancels unconfirmed changes.- Click the numbered marker in the source text to edit the note again. The trash button beside the note removes the annotation together with its marker and draft entry.- Hovering over the annotation count opens a panel where you can review or remove quotes, or click a quote to jump back and edit its note. Clicking or using the keyboard opens the panel too.diff --git a/apps/docs/content/docs/comments.zh-Hant.mdx b/apps/docs/content/docs/comments.zh-Hant.mdxindex c00b92df96..bd651af945 100644--- a/apps/docs/content/docs/comments.zh-Hant.mdx+++ b/apps/docs/content/docs/comments.zh-Hant.mdx@@ -50,7 +50,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";<Accordion title="編輯、刪除和快捷鍵" id="annotation-editing">- 編輯已有批註後,點選 **儲存批註** 才會應用修改。-- Enter 確認,Shift + Enter 換行;Esc 或點選框外會取消本次未確認的修改。+- 批註編輯框中,Enter 新增或儲存批註,Shift + Enter 換行;Cmd + Enter(macOS)或 Ctrl + Enter(Windows/Linux)儲存目前批註並傳送整份草稿,包括已儲存的批註、正文和附件。這些按鍵不受個人傳送快速鍵設定影響。Esc 或點選框外會取消本次未確認的修改。- 點選原文上的編號標記可以繼續編輯;點選批註框右側的刪除圖示,會同時移除這條批註、原文標記和草稿條目。- 滑鼠懸停在批註計數上會開啟浮層,可以檢視、刪除引用,或點選引用回到原位編輯意見。點選或使用鍵盤也能開啟這個浮層。diff --git a/apps/docs/content/docs/comments.zh.mdx b/apps/docs/content/docs/comments.zh.mdxindex d123b149cb..aa4f685892 100644--- a/apps/docs/content/docs/comments.zh.mdx+++ b/apps/docs/content/docs/comments.zh.mdx@@ -50,7 +50,7 @@ import { ResolveThreadDemo } from "@/components/demos/resolve-thread-demo";<Accordion title="编辑、删除和快捷键" id="annotation-editing">- 编辑已有批注后,点击 **保存批注** 才会应用修改。-- Enter 确认,Shift + Enter 换行;Esc 或点击框外会取消本次未确认的修改。+- 批注编辑框中,Enter 添加或保存批注,Shift + Enter 换行;Cmd + Enter(macOS)或 Ctrl + Enter(Windows/Linux)保存当前批注并发送整份草稿,包括已保存的批注、正文和附件。这些键位不受个人发送快捷键设置影响。Esc 或点击框外会取消本次未确认的修改。- 点击原文上的编号标记可以继续编辑;点击批注框右侧的删除图标,会同时移除这条批注、原文标记和草稿条目。- 鼠标悬停在批注计数上会打开浮层,可以查看、删除引用,或点击引用回到原位编辑意见。点击或使用键盘也能打开这个浮层。diff --git a/packages/views/editor/content-editor.tsx b/packages/views/editor/content-editor.tsxindex f51e956e99..ecbb54e985 100644--- a/packages/views/editor/content-editor.tsx+++ b/packages/views/editor/content-editor.tsx@@ -137,6 +137,8 @@ interface ContentEditorBaseProps {className?: string;debounceMs?: number;onSubmit?: () => void;+ /** Fixed annotation keys: Enter saves, Shift+Enter breaks, Mod+Enter submits. */+ onEnter?: () => void;onBlur?: () => void;/*** Upload transport. `uploadId` is minted by the editor when it inserts the@@ -371,6 +373,7 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(className,debounceMs = 300,onSubmit,+ onEnter,onBlur,onUploadFile,pasteAsFileThreshold,@@ -399,6 +402,7 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(const pendingBaseRef = useRef<string | null>(null);const onUpdateRef = useRef(onUpdate);const onSubmitRef = useRef(onSubmit);+ const onEnterRef = useRef(onEnter);const onBlurRef = useRef(onBlur);const onReadyRef = useRef(onReady);const onUploadingChangeRef = useRef(onUploadingChange);@@ -509,6 +513,7 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(// Keep refs in sync without recreating editoronUpdateRef.current = onUpdate;onSubmitRef.current = onSubmit;+ onEnterRef.current = onEnter;onBlurRef.current = onBlur;onReadyRef.current = onReady;onUploadingChangeRef.current = onUploadingChange;@@ -611,6 +616,7 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(placeholder: () => placeholderRef.current,queryClient,onSubmitRef,+ onEnterRef,onUploadFileRef,pasteAsFileThresholdRef,disableMentions,diff --git a/packages/views/editor/extensions/index.ts b/packages/views/editor/extensions/index.tsindex c4929d7f40..0c0dadef9d 100644--- a/packages/views/editor/extensions/index.ts+++ b/packages/views/editor/extensions/index.ts@@ -147,6 +147,7 @@ export interface EditorExtensionsOptions {placeholder?: string | (() => string);queryClient?: import("@tanstack/react-query").QueryClient;onSubmitRef?: RefObject<(() => void) | undefined>;+ onEnterRef?: RefObject<(() => void) | undefined>;onUploadFileRef?: RefObject<((file: File, uploadId: string) => Promise<UploadResult | null>) | undefined>;@@ -309,7 +310,7 @@ export function createEditorExtensions(if (!fn) return false;fn();return true;- }),+ }, () => options.onEnterRef?.current),createBlurShortcutExtension(),createFileUploadExtension(options.onUploadFileRef!, options.pasteAsFileThresholdRef),];diff --git a/packages/views/editor/extensions/submit-shortcut.test.ts b/packages/views/editor/extensions/submit-shortcut.test.tsindex eb7621ee28..3bf2dfb58c 100644--- a/packages/views/editor/extensions/submit-shortcut.test.ts+++ b/packages/views/editor/extensions/submit-shortcut.test.ts@@ -236,3 +236,31 @@ describe("Send = Enter editor behavior", () => {expect(editor.state.doc.firstChild?.textContent).toBe("line\n");});});++describe("annotation Enter actions", () => {+ it.each(["windows", "macos"] as const)("keeps save and send fixed on %s despite an Enter send preference", (platform) => {+ configureShortcutPlatform(platform);+ useShortcutStore.getState().setShortcut("send", createShortcutChord("Enter"));+ let saved = 0;+ let sent = 0;+ const editor = new Editor({+ element: document.createElement("div"),+ content: "<p>A note</p>",+ extensions: [StarterKit, createSubmitShortcutExtension(() => { sent++; return true; }, () => () => { saved++; })],+ });+ editors.push(editor);+ expect(press(editor, event("Enter"))).toBe(true);+ expect(saved).toBe(1);+ expect(sent).toBe(0);+ press(editor, event("Enter", { shiftKey: true }));+ expect(saved).toBe(1);+ expect(sent).toBe(0);+ expect(press(editor, event("Enter", platform === "macos" ? { metaKey: true } : { ctrlKey: true }))).toBe(true);+ expect(sent).toBe(1);+ press(editor, event("Enter", { repeat: true }));+ const composing = new KeyboardEvent("keydown", { key: "Enter", isComposing: true });+ press(editor, composing);+ expect(saved).toBe(1);+ expect(sent).toBe(1);+ });+});diff --git a/packages/views/editor/extensions/submit-shortcut.ts b/packages/views/editor/extensions/submit-shortcut.tsindex 1ab8b6cd3a..986b02cb54 100644--- a/packages/views/editor/extensions/submit-shortcut.ts+++ b/packages/views/editor/extensions/submit-shortcut.ts@@ -1,6 +1,7 @@import { Extension } from "@tiptap/core";import { Plugin } from "@tiptap/pm/state";import {+ createShortcutChord,getShortcut,isPlainShortcut,shortcutMatchesEvent,@@ -52,6 +53,7 @@ export function shouldReplayNativeEnter(*/export function createSubmitShortcutExtension(onSubmit: () => boolean,+ getEnterAction?: () => (() => void) | undefined,) {return Extension.create({name: "submitShortcut",@@ -67,6 +69,18 @@ export function createSubmitShortcutExtension(props: {handleKeyDown(view, event) {if (replayingEnter) return false;+ const enterAction = getEnterAction?.();+ if (enterAction) {+ if (event.repeat || view.composing || isImeComposing(event)) return false;+ if (event.key === "Enter" && !event.shiftKey && !event.metaKey && !event.ctrlKey && !event.altKey) {+ enterAction();+ return true;+ }+ return shouldHandleSubmitShortcut(event, {+ configuredShortcut: createShortcutChord("Enter", { primary: true }),+ composing: view.composing,+ }) ? onSubmit() : false;+ }const shortcut = getShortcut("send");if (diff --git a/packages/views/issues/components/annotation-composer.tsx b/packages/views/issues/components/annotation-composer.tsxindex ef89db74dd..bbe7177209 100644--- a/packages/views/issues/components/annotation-composer.tsx+++ b/packages/views/issues/components/annotation-composer.tsx@@ -1,140 +1,128 @@"use client";-import { useEffect, useRef, useState, type RefObject } from "react";+import { useRef, useState, type ReactNode, type RefObject } from "react";import { Loader2, Trash2 } from "@multica/ui/icons";-import { toast } from "sonner";-import { copyText } from "@multica/ui/lib/clipboard";+import { createShortcutChord } from "@multica/core/shortcuts";import { Button } from "@multica/ui/components/ui/button";import { IconButton } from "@multica/ui/components/common/icon-button";-import { composeSelectionReply, MAX_REPLY_ANNOTATIONS, type ReplyAnnotation } from "@multica/core/drafts/reply-annotation";-import type { AgentTask } from "@multica/core/types";+import { MAX_REPLY_ANNOTATIONS, type ReplyAnnotation } from "@multica/core/drafts/reply-annotation";import { ContentEditor, type ContentEditorRef } from "../../editor";import { EditorOverlayOwnerContext } from "../../editor/overlay-owner";-import { useComposerSubmit } from "../../editor/use-composer-submit";-import { useUploadGate } from "../../editor/use-upload-gate";+import { ShortcutKeycaps } from "../../common/shortcut-keycaps";import { useT } from "../../i18n";-import { commentTriggerPreviewSignature, useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";-import { useRecipientActions } from "../hooks/use-recipient-actions";-import { CommentTriggerChips } from "./comment-trigger-chips";-import { useStopRunsBeforeSend } from "./use-stop-runs-before-send";-export interface AnnotationReplyOptions {- onSubmit: (sourceId: string, content: string, suppressAgentIds?: string[], steerTaskIds?: string[]) => Promise<string | boolean>;- onAccepted?: (commentId: string) => void;- steerByDefault: (task: AgentTask) => boolean;+/** The existing reply/comment composer owns routing, uploads and submission. */+export interface AnnotationSendControls {+ submit: () => Promise<void>;+ submitting: boolean;+ uploading: boolean;+ targetMissing?: boolean;+ restart: boolean;+ recipients: ReactNode;+ draftContent: string;+ annotations: readonly ReplyAnnotation[];}+export interface AnnotationComposerSlot {+ pending: ReplyAnnotation;+ render: (controls?: AnnotationSendControls) => ReactNode;+}++export function annotationsWithPending(annotations: readonly ReplyAnnotation[], pending?: ReplyAnnotation): readonly ReplyAnnotation[] {+ if (!pending) return annotations;+ const saved = annotations.some((a) => a.id === pending.id);+ return saved ? annotations.map((a) => a.id === pending.id ? pending : a) : [...annotations, pending];+}++const ENTER = createShortcutChord("Enter");+const SEND = createShortcutChord("Enter", { primary: true });+export function AnnotationComposer({- issueId, owner, annotation, existing, number, parentId, editorRef, reply,- sourceMissing, sourceChanged, canSave, isSourceAvailable,- onChange, onSave, onRemove, onBusyChange, onAccepted,+ issueId, owner, annotation, existing, number, editorRef, controls,+ sourceMissing, sourceChanged, canSave, onChange, onSave, onRemove, onBusyChange,}: {issueId: string;owner: string;annotation: ReplyAnnotation;existing: boolean;number: number;- parentId?: string;editorRef: RefObject<ContentEditorRef | null>;- reply?: AnnotationReplyOptions;+ controls?: AnnotationSendControls;sourceMissing: boolean;sourceChanged: boolean;canSave: boolean;- isSourceAvailable: () => boolean;onChange: (note: string) => void;- onSave: (note: string) => void;+ onSave: (note: string, close: boolean) => boolean;onRemove?: () => void;onBusyChange: (busy: boolean) => void;- onAccepted: () => void;}) {const { t } = useT("issues");const [initialNote] = useState(annotation.note);- const direct = !existing && !!reply;- const composed = composeSelectionReply(annotation, annotation.note);- const preview = useCommentTriggerPreview({ issueId, parentId, content: direct ? composed : "" });- const { recipients, routing, setAction } = useRecipientActions({- issueId, agents: preview.agents, allowSteer: true,- steerByDefault: reply?.steerByDefault ?? (() => false), resetKey: `${issueId}:${annotation.id}`,- });- const stopRuns = useStopRunsBeforeSend(issueId);- const uploadGate = useUploadGate(editorRef);- const acceptedId = useRef<string | null>(null);- const mounted = useRef(true);- useEffect(() => {- mounted.current = true;- return () => { mounted.current = false; };- }, []);- const { submitting, submit } = useComposerSubmit({- editorRef, uploadGate,- normalize: (raw) => direct && isSourceAvailable() ? composeSelectionReply(annotation, raw) : "",- onSubmit: async (content) => {- if (!reply || !isSourceAvailable()) return false;- onBusyChange(true);- try {- const previewMatches = preview.isCurrent && commentTriggerPreviewSignature(content) === commentTriggerPreviewSignature(composed);- if (!(await stopRuns(previewMatches ? routing.restartTaskIds : []))) return false;- const result = await reply.onSubmit(annotation.sourceCommentId, content,- routing.suppressAgentIds.length ? routing.suppressAgentIds : undefined,- routing.steerTaskIds.length ? routing.steerTaskIds : undefined);- acceptedId.current = typeof result === "string" ? result : null;- return !!result;- } finally {- onBusyChange(false);- }- },- onAccepted: () => {- if (!mounted.current) return;- onAccepted();- if (acceptedId.current) reply?.onAccepted?.(acceptedId.current);- },- });+ const [sending, setSending] = useState(false);+ const inFlight = useRef(false);+ const busy = sending || controls?.submitting === true;+ const otherAnnotations = controls?.annotations.filter((a) => a.id !== annotation.id).length ?? 0;+ const hasBody = !!controls?.draftContent.trim();+ const sendAll = otherAnnotations > 0 || hasBody;const save = () => {- if (submitting || !canSave) return;+ if (busy || inFlight.current || !canSave) return;const note = editorRef.current?.getMarkdown() ?? "";- if (note.trim()) onSave(note);+ if (note.trim()) onSave(note, true);};- const saveLabel = t(($) => existing ? $.reply.annotations.save : $.reply.annotations.confirm_add);- const copyNote = async () => {+ const send = async () => {+ if (!controls || controls.targetMissing || busy || inFlight.current || !canSave) return;const note = editorRef.current?.getMarkdown() ?? "";- if (await copyText(note)) toast.success(t(($) => $.reply.annotations.note_copied));- else toast.error(t(($) => $.reply.annotations.note_copy_failed));+ if (!note.trim()) return;+ inFlight.current = true;+ onBusyChange(true);+ setSending(true);+ try {+ // Commit first: the existing composer's failure/retry path owns the note.+ if (onSave(note, false)) await controls.submit();+ } finally {+ inFlight.current = false;+ onBusyChange(false);+ setSending(false);+ }};return <EditorOverlayOwnerContext.Provider value={owner}>- <div className="flex w-96 max-w-[calc(100vw-26px)] flex-col gap-1" aria-busy={submitting || undefined}>- <div className={submitting ? "pointer-events-none opacity-60" : undefined} inert={submitting || undefined}>+ <div className="flex w-[30rem] max-w-[calc(100vw-26px)] flex-col gap-1" aria-busy={busy || undefined}>+ <div className={busy ? "pointer-events-none opacity-60" : undefined} inert={busy || undefined}><ContentEditor ref={editorRef} defaultValue={initialNote}ariaLabel={t(($) => $.reply.annotations.note_label)}placeholder={t(($) => $.reply.annotations.note_placeholder)}className="min-h-8 max-h-32 overflow-y-auto px-2 py-1.5"currentIssueId={issueId} showBubbleMenu={false} debounceMs={100}- onUpdate={onChange} onSubmit={direct ? submit : save} />+ onUpdate={onChange} onEnter={save} onSubmit={send} /></div>- {sourceMissing && <div className="px-2">- <p role="alert" className="text-caption text-destructive">{t(($) => $.reply.annotations.direct_target_deleted)}</p>- <Button size="sm" variant="ghost" disabled={!annotation.note.trim() || submitting}- onClick={copyNote}>{t(($) => $.reply.annotations.copy_note)}</Button>- </div>}- {!sourceMissing && sourceChanged && <p className="px-2 text-caption text-muted-foreground">{t(($) => $.reply.annotations.source_changed)}</p>}+ {(sourceMissing || sourceChanged) && <p role={sourceMissing ? "alert" : undefined} className="px-2 text-caption text-muted-foreground">+ {t(($) => $.reply.annotations.source_changed)}+ </p>}+ {controls?.targetMissing && <p role="alert" className="px-2 text-caption text-destructive">+ {t(($) => $.reply.annotations.target_deleted)}+ </p>}{!canSave && <p className="px-2 text-caption text-muted-foreground">{t(($) => $.reply.annotations.count_limit, { count: MAX_REPLY_ANNOTATIONS })}</p>}- <div className="flex flex-wrap items-center gap-1 px-1 pb-1" inert={submitting || undefined}>+ {sendAll && <p className="px-2 text-caption text-muted-foreground">+ {otherAnnotations ? t(($) => hasBody ? $.reply.annotations.send_with_annotations_and_body : $.reply.annotations.send_with_annotations, { count: otherAnnotations })+ : t(($) => $.reply.annotations.send_with_body)}+ </p>}+ <div className="flex flex-wrap items-center gap-1 px-1 pb-1" inert={busy || undefined}>{existing && onRemove && <IconButton variant="ghost" size="icon-sm"className="text-muted-foreground hover:text-destructive" label={t(($) => $.reply.annotations.remove, { number })}- disabled={submitting} onClick={onRemove}><Trash2 /></IconButton>}- {direct && <div className="min-w-0 flex-1">- <CommentTriggerChips recipients={recipients} blocked={preview.blocked}- hasAllMembersMention={preview.hasAllMembersMention} draftContent={composed} onActionChange={setAction} />- </div>}+ disabled={busy} onClick={onRemove}><Trash2 /></IconButton>}+ <div className="min-w-0 flex-1">{controls?.recipients}</div><div className="ml-auto flex items-center gap-1">- <Button size="sm" variant={direct ? "ghost" : "default"} className={direct ? "text-muted-foreground" : undefined}- disabled={!annotation.note.trim() || !canSave || submitting}- onClick={save}>{saveLabel}</Button>- {direct && <Button size="sm" variant={routing.restartTaskIds.length ? "destructive" : "default"}- disabled={!composed || sourceMissing || submitting} onClick={submit} aria-busy={submitting || undefined}>- {submitting && <Loader2 className="animate-spin" />}- {t(($) => routing.restartTaskIds.length ? $.comment.restart_send- : parentId ? $.reply.annotations.direct_reply : $.reply.annotations.direct_comment)}+ {controls && <Button size="sm" variant={controls.restart ? "destructive" : "ghost"}+ disabled={!annotation.note.trim() || !canSave || busy || controls.uploading || controls.targetMissing} onClick={send} aria-busy={busy || undefined}>+ {busy && <Loader2 className="animate-spin" />}+ {t(($) => controls.restart ? $.comment.restart_send : sendAll ? $.reply.annotations.send_all : $.comment.send_tooltip)}+ <ShortcutKeycaps shortcut={SEND} decorative /></Button>}+ <Button size="sm" disabled={!annotation.note.trim() || !canSave || busy} onClick={save}>+ {t(($) => existing ? $.reply.annotations.save : $.reply.annotations.confirm_add)}+ <ShortcutKeycaps shortcut={ENTER} decorative />+ </Button></div></div></div>diff --git a/packages/views/issues/components/annotation-reply-interactions.test.tsx b/packages/views/issues/components/annotation-reply-interactions.test.tsxindex a438e9b01d..60cbd62124 100644--- a/packages/views/issues/components/annotation-reply-interactions.test.tsx+++ b/packages/views/issues/components/annotation-reply-interactions.test.tsx@@ -1,144 +1,257 @@-import { act, fireEvent, screen, waitFor } from "@testing-library/react";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { useState } from "react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import type { Editor } from "@tiptap/core";+import { configureShortcutPlatform, createShortcutChord, useShortcutStore } from "@multica/core/shortcuts";+import { WorkspaceSlugProvider } from "@multica/core/paths";import { useCommentDraftStore } from "@multica/core/issues/stores";+import { composeAnnotatedReply, type ReplyAnnotation } from "@multica/core/drafts/reply-annotation";+import { toast } from "sonner";import { renderWithI18n } from "../../test/i18n";import { useCommentAnnotations } from "./use-comment-annotations";-import { toast } from "sonner";+import { ReplyInput } from "./reply-input";+import { CommentInput } from "./comment-input";++// Avatar profile navigation is unrelated to composer behavior.+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => null, AgentStatusDot: () => null }));+const preview = vi.hoisted(() => vi.fn<typeof import("@multica/core/api")["api"]["previewCommentTriggers"]>(async () => ({ agents: [], blocked: [] })));vi.mock("@multica/core/api", async (original) => {const actual = await original<typeof import("@multica/core/api")>();- return { ...actual, api: { ...actual.api,- previewCommentTriggers: vi.fn(async () => ({ agents: [], blocked: [] })),- listTasksByIssue: vi.fn(async () => []),- } };+ return { ...actual, api: { ...actual.api, getBaseUrl: () => "https://api.example.test", previewCommentTriggers: preview, listTasksByIssue: vi.fn(async () => []),+ listWorkspaces: vi.fn(async () => [{ id: "workspace", slug: "test", name: "Test" }]),+ listMembers: vi.fn(async () => []), listAgents: vi.fn(async () => []), listSquads: vi.fn(async () => []),+ listQuickActions: vi.fn(async () => ({ quick_actions: [] })) } };});-const writeText = vi.fn(async (_text: string) => {});--const draftKey = "reply:issue:root" as const;-function Fixture({ deleted = false, onSubmit = async () => false }: {- deleted?: boolean; onSubmit?: (sourceId: string, content: string) => Promise<boolean>;+const key = "reply:issue:root" as const;+type Submit = (content: string, attachments?: string[], suppress?: string[], steer?: string[]) => Promise<string | boolean>;+function Fixture({ deleted = false, description = false, onSubmit = async () => false }: {+ deleted?: boolean; description?: boolean; onSubmit?: Submit;}) {- const [client] = useState(() => new QueryClient({ defaultOptions: { queries: { retry: false } } }));- const annotations = useCommentAnnotations({ issueId: "issue", draftKey, enabled: true,+ const [client] = useState(() => {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ client.setQueryData(["workspaces", "list"], [{ id: "workspace", slug: "test", name: "Test" }]);+ return client;+ });+ const annotations = useCommentAnnotations({ issueId: "issue", draftKey: description ? "new:issue" : key, enabled: true,sources: [{ id: "root", name: "Root" }, ...(!deleted ? [{ id: "child", name: "Child" }] : [])],- reply: { onSubmit, steerByDefault: () => false },});- return <QueryClientProvider client={client}><div ref={annotations.cardRef} {...annotations.captureProps}>+ const replyTarget = useCommentDraftStore((s) => s.drafts[key]?.replyTarget);+ return <QueryClientProvider client={client}><WorkspaceSlugProvider slug="test"><div ref={annotations.cardRef} {...annotations.captureProps}>{annotations.popup}<div data-comment-content="root" tabIndex={0}>Root text</div>{!deleted && <div data-comment-content="child" tabIndex={0}>Child text</div>}- </div></QueryClientProvider>;+ {description ? <CommentInput issueId="issue" onSubmit={onSubmit} annotationComposer={annotations.composer}+ onEditAnnotation={annotations.editAnnotation} /> : <ReplyInput issueId="issue" parentId={replyTarget?.commentId ?? "root"} draftKey={key}+ targetMissing={deleted && replyTarget?.commentId === "child"}+ avatarType="member" avatarId="" onSubmit={onSubmit} annotationComposer={annotations.composer}+ onEditAnnotation={annotations.editAnnotation} />}+ </div></WorkspaceSlugProvider></QueryClientProvider>;}-function selectText(container: HTMLElement, id: string) {+function saved(id: string, quote = "Root text"): ReplyAnnotation {+ return { id, sourceCommentId: "root", sourceActorName: "Root", quote, start: 0, prefix: "", suffix: "", note: `Saved ${id}` };+}+function selectText(container: HTMLElement, id = "child") {const source = container.querySelector<HTMLElement>(`[data-comment-content="${id}"]`)!;fireEvent.pointerDown(source);- const range = document.createRange();- range.selectNodeContents(source);+ const range = document.createRange(); range.selectNodeContents(source);act(() => { window.getSelection()!.removeAllRanges(); window.getSelection()!.addRange(range); });fireEvent.pointerUp(source);- return source;}--async function typeNote(value: string) {+async function open(container: HTMLElement, text = "Please revise") {+ selectText(container);+ fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));const input = await screen.findByRole("textbox", { name: "Comment" });- await act(async () => { (input as HTMLElement & { editor: Editor }).editor.commands.setContent(value); });- await waitFor(() => expect(screen.getByRole("button", { name: "Reply" })).toBeEnabled());+ await type(input, text);return input;}+async function type(input: HTMLElement, text: string) {+ await act(async () => { (input as HTMLElement & { editor: Editor }).editor.commands.setContent(text, { contentType: text.startsWith("<") ? "html" : "markdown" }); });+ await waitFor(() => expect(screen.getByRole("button", { name: /^(Add|Save) annotation$/ })).toBeEnabled());+}+function popup(input: HTMLElement) { return within(input.closest("[data-reply-annotation-overlay]")! as HTMLElement); }beforeEach(() => {useCommentDraftStore.setState({ drafts: {} });- writeText.mockClear();- Object.defineProperty(navigator, "clipboard", { configurable: true, value: { writeText } });+ configureShortcutPlatform("windows");+ preview.mockReset();+ preview.mockResolvedValue({ agents: [], blocked: [] });+ Object.defineProperty(navigator, "clipboard", { configurable: true, value: { writeText: vi.fn(async () => {}) } });Object.defineProperty(document.documentElement, "clientWidth", { configurable: true, value: 1024 });Object.defineProperty(document.documentElement, "clientHeight", { configurable: true, value: 768 });vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockReturnValue(new DOMRect(10, 10, 600, 400));- Range.prototype.getBoundingClientRect = function () {- return this.collapsed ? new DOMRect() : new DOMRect(10, 10, 120, 20);- };- Range.prototype.getClientRects = function () {- return [this.getBoundingClientRect()] as unknown as DOMRectList;- };+ Range.prototype.getBoundingClientRect = function () { return this.collapsed ? new DOMRect() : new DOMRect(10, 10, 120, 20); };+ Range.prototype.getClientRects = function () { return [this.getBoundingClientRect()] as unknown as DOMRectList; };});+afterEach(() => { vi.restoreAllMocks(); useShortcutStore.getState().resetAll(); configureShortcutPlatform(null); });++describe("annotation draft submission through the real composer", () => {+ it.each([false, true])("sends all saved annotations and body through the existing composer (description: %s)", async (description) => {+ const draftKey = description ? "new:issue" as const : key;+ const store = useCommentDraftStore.getState();+ const first = saved("one"), second = saved("two", "Other quote");+ store.setDraft(draftKey, "Overall draft");+ store.addAnnotation(draftKey, first); store.addAnnotation(draftKey, second);+ const onSubmit = vi.fn<Submit>(async () => "published");+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} description={description} />);+ const input = await open(view.container, "[@Agent](mention://agent/11111111-1111-1111-1111-111111111111) Please revise");+ const pending = { ...saved("new", "Child text"), sourceCommentId: "child", sourceActorName: "Child", note: input.textContent! };+ const expected = composeAnnotatedReply("Overall draft", [first, second, { ...pending, note: "[@Agent](mention://agent/11111111-1111-1111-1111-111111111111) Please revise" }]);+ await waitFor(() => expect(preview).toHaveBeenCalledWith("issue", expected, description ? undefined : "root", undefined));+ expect(popup(input).getByText("Will send with saved annotations (2) and draft text.")).toBeVisible();+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith(expected, undefined, undefined, undefined));+ await waitFor(() => expect(useCommentDraftStore.getState().drafts[draftKey]).toBeUndefined());+ expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument();+ // Acceptance must also release the selection dismissal/submission lock.+ const next = await open(view.container, "A second note");+ fireEvent.click(popup(next).getByRole("button", { name: "Send" }));+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(2));+ });-describe("selection replies with the real ContentEditor", () => {- it("sends through the real ContentEditor", async () => {+ it("uses Enter to save and Shift+Enter for a newline despite the Enter-send preference", async () => {+ useShortcutStore.getState().setShortcut("send", createShortcutChord("Enter"));const onSubmit = vi.fn(async () => true);- const { container } = renderWithI18n(<Fixture onSubmit={onSubmit} />);- selectText(container, "child");- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- await typeNote("Please revise");- fireEvent.click(screen.getByRole("button", { name: "Reply" }));- await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("child", "> Child text\n\nPlease revise", undefined, undefined));+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ const input = await open(view.container, "First line");+ await waitFor(() => expect(preview).toHaveBeenCalledWith("issue", "> Child text\n\nFirst line", "child", undefined));+ const before = (input as HTMLElement & { editor: Editor }).editor.getText();+ fireEvent.keyDown(input, { key: "Enter", isComposing: true });+ fireEvent.keyDown(input, { key: "Enter", keyCode: 229 });+ expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(0);+ fireEvent.keyDown(input, { key: "Enter", shiftKey: true });+ expect((input as HTMLElement & { editor: Editor }).editor.getText()).not.toBe(before);+ fireEvent.keyDown(input, { key: "Enter" });+ await waitFor(() => expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(1));+ expect(onSubmit).not.toHaveBeenCalled();+ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ const edit = await screen.findByRole("textbox", { name: "Comment" });+ await type(edit, "Updated existing note");+ fireEvent.keyDown(edit, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("> Child text\n\nUpdated existing note", undefined, undefined, undefined));});- it.each([false, true])("copies the deleted target's latest note before leaving (quota full: %s)", async (full) => {- if (full) {- for (let i = 0; i < 20; i++) useCommentDraftStore.getState().addAnnotation(draftKey, {- id: `saved-${i}`, sourceCommentId: "root", sourceActorName: "Root",- quote: "Root", start: i, prefix: "", suffix: " text", note: `Saved ${i}`,- });- }- const view = renderWithI18n(<Fixture />);- selectText(view.container, "child");- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const input = await typeNote("Do not lose this instruction");- view.rerender(<Fixture deleted />);- expect(await screen.findByRole("alert")).toHaveTextContent("Copy your note before selecting another comment");- expect(screen.getByRole("button", { name: "Reply" })).toBeDisabled();- if (full) expect(screen.getByRole("button", { name: "Add annotation" })).toBeDisabled();- // Copy reads the editor synchronously, including edits not yet debounced.- await act(async () => { (input as HTMLElement & { editor: Editor }).editor.commands.setContent("Latest instruction"); });- const copy = screen.getByRole("button", { name: "Copy note" });- fireEvent.pointerDown(copy);- fireEvent.click(copy);- await waitFor(() => expect(writeText).toHaveBeenCalledWith("Latest instruction"));+ it("keeps failed sends in the persisted draft and retries without duplicating the annotation", async () => {+ let finish!: (result: boolean) => void;+ const onSubmit = vi.fn(() => new Promise<boolean>((resolve) => { finish = resolve; }));+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ const input = await open(view.container, "Keep on failure");+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ fireEvent.pointerDown(document.body); fireEvent.keyDown(input, { key: "Escape" });expect(input).toBeInTheDocument();- selectText(view.container, "root");- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- await act(async () => { (screen.getByRole("textbox", { name: "Comment" }) as HTMLElement & { editor: Editor }).editor.commands.setContent(writeText.mock.calls[0]![0]); });- expect(screen.getByRole("textbox", { name: "Comment" })).toHaveTextContent("Latest instruction");+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));+ expect(useCommentDraftStore.getState().getAnnotations(key)[0]?.note).toBe("Keep on failure");+ await act(async () => finish(false));+ expect(popup(input).getByRole("button", { name: "Send" })).toBeEnabled();+ fireEvent.pointerDown(document.body);+ view.unmount();+ renderWithI18n(<Fixture onSubmit={async () => "retry-accepted"} />);+ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ const recovered = await screen.findByRole("textbox", { name: "Comment" });+ expect(recovered).toHaveTextContent("Keep on failure");+ fireEvent.keyDown(recovered, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(useCommentDraftStore.getState().drafts[key]).toBeUndefined());});- it("keeps the note and shows manual recovery when clipboard copying fails", async () => {- Object.defineProperty(navigator, "clipboard", { configurable: true, value: undefined });- Object.defineProperty(document, "execCommand", { configurable: true, value: vi.fn(() => false) });- const error = vi.spyOn(toast, "error");- const view = renderWithI18n(<Fixture />);- selectText(view.container, "child");+ it("keeps a deleted non-target source's quote while the first annotation's target survives", async () => {+ const first = saved("first");+ useCommentDraftStore.getState().addAnnotation(key, first);+ const onSubmit = vi.fn<Submit>(async () => "posted");+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ const input = await open(view.container, "Retain this instruction");+ view.rerender(<Fixture deleted onSubmit={onSubmit} />);+ expect(await screen.findByRole("alert")).toHaveTextContent("The source changed or is unavailable");+ expect(input).toHaveTextContent("Retain this instruction");+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith(composeAnnotatedReply("", [first, { ...saved("pending", "Child text"), sourceCommentId: "child", note: "Retain this instruction" }]), undefined, undefined, undefined));+ });++ it("blocks an extra annotation at the quota, while an existing annotation can still be saved and sent", async () => {+ const store = useCommentDraftStore.getState();+ for (let i = 0; i < 20; i++) store.addAnnotation(key, saved(`quota-${i}`, i ? `Quote ${i}` : "Root text"));+ const onSubmit = vi.fn<Submit>(async () => "posted");+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ selectText(view.container);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const input = await typeNote("Recover manually");- view.rerender(<Fixture deleted />);- const copy = await screen.findByRole("button", { name: "Copy note" });- fireEvent.pointerDown(copy);- copy.focus();- fireEvent.click(copy);- await waitFor(() => expect(error).toHaveBeenCalledWith("Could not copy note. Select and copy the text manually."));+ const input = await screen.findByRole("textbox", { name: "Comment" });+ await act(async () => { (input as HTMLElement & { editor: Editor }).editor.commands.setContent("Over quota"); });+ await waitFor(() => expect(popup(input).getByRole("button", { name: "Add annotation" })).toBeDisabled());+ expect(popup(input).getByRole("button", { name: "Send all" })).toBeDisabled();+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ expect(onSubmit).not.toHaveBeenCalled();+ fireEvent.keyDown(input, { key: "Escape" });+ fireEvent.click(await screen.findByRole("button", { name: "Edit annotation 1" }));+ const edit = await screen.findByRole("textbox", { name: "Comment" });+ await type(edit, "Revised at quota");+ fireEvent.keyDown(edit, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));+ expect(onSubmit.mock.calls[0]![0]).toContain("Revised at quota");+ expect(onSubmit.mock.calls[0]![0]).not.toContain("Over quota");+ });++ it.each(["popup", "lower"])("requires matching targets before applying recipient choices (send: %s)", async (sendFrom) => {+ const showError = vi.spyOn(toast, "error").mockReturnValue("test-toast");+ const agentId = "11111111-1111-1111-1111-111111111111";+ preview.mockResolvedValue({ agents: [{ id: agentId, name: "Agent", source: "thread_parent", reason: "" }] });+ if (sendFrom === "lower") useCommentDraftStore.getState().setDraft(key, "Root reply body");+ const onSubmit = vi.fn<Submit>(async () => "posted");+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ const input = await open(view.container, "Please revise");+ const chip = await popup(input).findByRole("button", { name: "Agent trigger: Will start when sent" });+ fireEvent.pointerDown(chip); fireEvent.click(chip);+ const skip = await screen.findByRole("menuitemradio", { name: /Won't start this time/ });+ fireEvent.pointerDown(skip); fireEvent.click(skip);expect(input).toBeInTheDocument();- expect(input).toHaveTextContent("Recover manually");+ await waitFor(() => expect(screen.getAllByRole("button", { name: "Agent trigger: Won't start this time" })).toHaveLength(2));+ if (sendFrom === "popup") fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ else {+ fireEvent.click(within(view.container).getByRole("button", { name: "Send" }));+ await waitFor(() => expect(showError).toHaveBeenCalledWith("Reply target changed. Review the recipients before sending again."));+ expect(onSubmit).not.toHaveBeenCalled();+ expect(useCommentDraftStore.getState().getDraft(key)).toBe("Root reply body");+ expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(0);+ expect(input).toHaveTextContent("Please revise");+ // Return to the root reply and explicitly confirm its recipient choice.+ fireEvent.keyDown(input, { key: "Escape" });+ const rootChip = await within(view.container).findByRole("button", { name: "Agent trigger: Will start when sent" });+ fireEvent.click(rootChip);+ fireEvent.click(await screen.findByRole("menuitemradio", { name: /Won't start this time/ }));+ fireEvent.click(within(view.container).getByRole("button", { name: "Send" }));+ }+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith(sendFrom === "popup" ? "> Child text\n\nPlease revise" : "Root reply body", undefined, [agentId], undefined));});- it.each([false, true])("keeps the unsent note when copying its hovered link (clipboard fallback: %s)", async (fallback) => {+ it("saves the note but respects the lower composer's in-flight upload gate", async () => {+ const onSubmit = vi.fn<Submit>(async () => "posted");+ const view = renderWithI18n(<Fixture onSubmit={onSubmit} />);+ const input = await open(view.container, "Wait for the file");+ await act(async () => { useCommentDraftStore.getState().addUpload(key, {+ clientUploadId: "upload", status: "uploading", filename: "pending.txt", size: 10,+ }); });+ expect(popup(input).getByRole("button", { name: "Send" })).toBeDisabled();+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(1));+ expect(onSubmit).not.toHaveBeenCalled();+ await act(async () => { useCommentDraftStore.getState().removeUpload(key, "upload"); });+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));+ });++ it.each([false, true])("keeps the note when copying its hovered link (clipboard fallback: %s)", async (fallback) => {if (fallback) {Object.defineProperty(navigator, "clipboard", { configurable: true, value: undefined });Object.defineProperty(document, "execCommand", { configurable: true, value: vi.fn(() => true) });}const view = renderWithI18n(<Fixture />);- selectText(view.container, "child");- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const input = await typeNote('<p>Please inspect <a href="https://example.com">this page</a></p>');- const link = input.querySelector("a")!;- fireEvent.mouseOver(link);+ const input = await open(view.container, '<p>Please inspect <a href="https://example.com">this page</a></p>');+ fireEvent.mouseOver(input.querySelector("a")!);const copy = await screen.findByRole("button", { name: "Copy link" });- fireEvent.pointerDown(copy);- copy.focus();- fireEvent.click(copy);- await waitFor(() => expect(fallback ? document.execCommand : writeText).toHaveBeenCalledWith(fallback ? "copy" : "https://example.com"));+ fireEvent.pointerDown(copy); copy.focus(); fireEvent.click(copy);+ await waitFor(() => expect(fallback ? document.execCommand : navigator.clipboard.writeText).toHaveBeenCalledWith(fallback ? "copy" : "https://example.com"));expect(input).toBeInTheDocument();expect(input).toHaveTextContent("Please inspect this page");});diff --git a/packages/views/issues/components/comment-card-edit-gate.test.tsx b/packages/views/issues/components/comment-card-edit-gate.test.tsxindex fd3eac03e5..9ef8fad7ab 100644--- a/packages/views/issues/components/comment-card-edit-gate.test.tsx+++ b/packages/views/issues/components/comment-card-edit-gate.test.tsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from "vitest";-import { act, fireEvent, screen, waitFor } from "@testing-library/react";+import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";import { forwardRef, useEffect, useImperativeHandle, useRef, type ComponentProps, type ReactNode, type Ref } from "react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import type { Attachment, TimelineEntry } from "@multica/core/types";@@ -371,7 +371,7 @@ describe("comment edit — upload submit gate", () => {// Keep the real card, annotation hook, reply composer and submit wiring together.// Source parsing and persistence boundary matrices live in their own suites.describe("comment thread — selection reply", () => {- it.each([[false, "agent", "agent-1", "comment"], [true, "agent", "agent-1", "comment"], [false, "member", "user-1", "comment"], [false, "member", "other-user", "comment"], [false, "member", "user-1", "note"]] as const)("sends quotes in the source thread and clears overlays (open: %s, author: %s %s, type: %s)", async (keepNoteOpen, actorType, actorId, commentType) => {+ it.each([[false, "agent", "agent-1", "comment", "lower"], [true, "agent", "agent-1", "comment", "lower"], [false, "member", "user-1", "comment", "lower"], [false, "member", "other-user", "comment", "lower"], [false, "member", "user-1", "note", "lower"], [false, "agent", "agent-1", "comment", "popup-button"], [false, "agent", "agent-1", "comment", "popup-shortcut"]] as const)("replies to the first annotated comment and clears overlays (open: %s, author: %s %s, type: %s, send: %s)", async (keepNoteOpen, actorType, actorId, commentType, sendFrom) => {Object.defineProperty(document.documentElement, "clientWidth", { configurable: true, value: 1024 });Object.defineProperty(document.documentElement, "clientHeight", { configurable: true, value: 768 });vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockReturnValue(new DOMRect(10, 10, 600, 400));@@ -399,15 +399,16 @@ describe("comment thread — selection reply", () => {fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));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 (sendFrom === "lower") 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");+ if (sendFrom === "lower") 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();- fireEvent.click(screen.getByRole("button", { name: "Send" }));+ if (sendFrom === "popup-shortcut") fireEvent.keyDown(screen.getByRole("textbox", { name: "Comment" }), { key: "Enter", ctrlKey: true });+ else fireEvent.click(within(sendFrom === "lower" ? container : document.querySelector<HTMLElement>("[data-reply-annotation-overlay]")!).getByRole("button", { name: "Send" }));await waitFor(() => expect(onReply).toHaveBeenCalledTimes(1));expect(onReply).toHaveBeenCalledWith("agent-child", "> Selected agent text\n\nReply-specific note", undefined, undefined, undefined);await waitFor(() => {@@ -417,4 +418,34 @@ describe("comment thread — selection reply", () => {expect(useCommentDraftStore.getState().drafts["new:issue-1"]).toBe(taskDraft);expect(useCommentDraftStore.getState().getDraft("reply:issue-1:other-thread")).toBe("Other thread draft");});++ it.each([false, true])("blocks lower and popup sends when the fixed target is gone (tombstone: %s)", async (tombstone) => {+ const draftKey = "reply:issue-1:comment-1";+ const store = useCommentDraftStore.getState();+ const annotation = { id: "saved", sourceCommentId: "agent-child", sourceActorName: "Agent B", quote: "Saved quote", start: 0, prefix: "", suffix: "", note: "Keep this note" };+ store.setDraft(draftKey, "Keep this body");+ store.addAnnotation(draftKey, annotation);+ const other = { ...annotation, id: "other", sourceCommentId: entry.id, sourceActorName: "Ada", quote: entry.content!, note: "Keep this other note" };+ store.addAnnotation(draftKey, other);+ const onReply = vi.fn().mockResolvedValue("should-not-send");+ const deletedChild = { ...entry, id: "agent-child", parent_id: entry.id, deleted_at: "2026-11-09T00:00:00Z", content: "" };+ const { container } = renderCard(undefined, { replies: tombstone ? [deletedChild] : [], onReply });+ expect(await screen.findByRole("alert")).toHaveTextContent("The reply target was deleted");+ expect(within(container).getByRole("button", { name: "Send" })).toBeDisabled();+ fireEvent.keyDown(within(container).getByTestId("editor"), { key: "Enter", ctrlKey: true });+ fireEvent.click(screen.getByRole("button", { name: "2 annotations" }));+ fireEvent.click(within(screen.getByRole("dialog", { name: "2 annotations" })).getByRole("button", { name: "Edit annotation 2" }));+ const input = await screen.findByRole("textbox", { name: "Comment" });+ const popup = within(input.closest("[data-reply-annotation-overlay]")! as HTMLElement);+ expect(popup.getByRole("button", { name: "Send all" })).toBeDisabled();+ expect(popup.getByText(/The reply target was deleted/)).toBeVisible();+ expect(popup.getByRole("button", { name: "Save annotation" })).toBeEnabled();+ fireEvent.change(input, { target: { value: "Unconfirmed edit" } });+ fireEvent.keyDown(input, { key: "Enter", ctrlKey: true });+ await act(async () => {});+ expect(onReply).not.toHaveBeenCalled();+ expect(useCommentDraftStore.getState().getDraft(draftKey)).toBe("Keep this body");+ expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toEqual([annotation, other]);+ expect(input).toHaveValue("Unconfirmed edit");+ });});diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsxindex 167f13033d..ef0957395e 100644--- a/packages/views/issues/components/comment-card.tsx+++ b/packages/views/issues/components/comment-card.tsx@@ -1045,8 +1045,9 @@ function CommentCardImpl({const replyTarget = useCommentDraftStore((s) => s.drafts[`reply:${issueId}:${entry.id}`]?.replyTarget);const replyTargetId = replyTarget?.commentId ?? entry.id;// A deleted target's tombstone is as gone as a removed row.- const replyTargetMissing = !!replyTarget && replyTargetId !== entry.id- && !replies.some((r) => r.id === replyTargetId && !isDeletedComment(r));+ const isReplyTargetMissing = (id: string) => id !== entry.id+ && !replies.some((r) => r.id === id && !isDeletedComment(r));+ const replyTargetMissing = !!replyTarget && isReplyTargetMissing(replyTargetId);// A reply here goes into the running turn of a run that belongs to this// thread by default; another thread's turn is only reached by choice.const steerThreadRunByDefault = useCallback(@@ -1055,15 +1056,11 @@ function CommentCardImpl({);const annotation = useCommentAnnotations({issueId,- reply: {- onSubmit: (sourceId, content, suppressAgentIds, steerTaskIds) => onReply(sourceId, content, undefined, suppressAgentIds, steerTaskIds),- onAccepted: onReplyAccepted, steerByDefault: steerThreadRunByDefault,- },draftKey: `reply:${issueId}:${entry.id}`,sources: [entry, ...replies].filter((e) => e.type === "comment" && !isDeletedComment(e)).map((e) => ({ id: e.id, name: e.actor_name || getActorName(e.actor_type, e.actor_id), revision: e.revision })),enabled: !!currentUserId,- onAdded: () => { if (replyFolded) onResolvedExpandChange?.(entry.id, true); },+ onOpen: () => { if (replyFolded) onResolvedExpandChange?.(entry.id, true); },});const isCollapsed = useCommentCollapseStore((s) => s.isCollapsed(issueId, entry.id));const toggleCollapse = useCommentCollapseStore((s) => s.toggle);@@ -1538,6 +1535,7 @@ function CommentCardImpl({issueId={issueId}parentId={replyTargetId}targetMissing={replyTargetMissing}+ annotationComposer={annotation.composer}placeholder={t(($) => $.reply.placeholder)}size="sm"avatarType="member"@@ -1545,7 +1543,12 @@ function CommentCardImpl({draftKey={`reply:${issueId}:${entry.id}`}onEditAnnotation={(id) => annotation.editAnnotation(id, true)}steerByDefault={steerThreadRunByDefault}- onSubmit={(content, attachmentIds, suppressAgentIds, steerTaskIds) => replyTargetMissing ? Promise.resolve(false) : onReply(replyTargetId, content, attachmentIds, suppressAgentIds, steerTaskIds)}+ onSubmit={(content, attachmentIds, suppressAgentIds, steerTaskIds) => {+ // The popup can save the first annotation and submit in the same event.+ const targetId = useCommentDraftStore.getState().drafts[`reply:${issueId}:${entry.id}`]?.replyTarget?.commentId ?? entry.id;+ return isReplyTargetMissing(targetId) ? Promise.resolve(false)+ : onReply(targetId, content, attachmentIds, suppressAgentIds, steerTaskIds);+ }}onAccepted={onReplyAccepted}/></div>diff --git a/packages/views/issues/components/comment-composers.test.tsx b/packages/views/issues/components/comment-composers.test.tsxindex 05b3fe5854..b9e8a3e573 100644--- a/packages/views/issues/components/comment-composers.test.tsx+++ b/packages/views/issues/components/comment-composers.test.tsx@@ -1,4 +1,4 @@-import { forwardRef, useEffect, useImperativeHandle, useRef, useState, type ReactNode, type Ref } from "react";+import { forwardRef, useEffect, useImperativeHandle, useRef, useState, type ComponentProps, type ReactNode, type Ref } from "react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { describe, it, expect, vi, beforeEach } from "vitest";import { act, fireEvent, screen, waitFor } from "@testing-library/react";@@ -241,6 +241,12 @@ function renderCommentInput(onSubmit = vi.fn().mockResolvedValue(true)) {return { ...view, onSubmit };}+function DraftReplyInput(props: ComponentProps<typeof ReplyInput>) {+ const parentId = useCommentDraftStore((s) =>+ (props.draftKey ? s.drafts[props.draftKey]?.replyTarget?.commentId : undefined) ?? props.parentId);+ return <ReplyInput {...props} parentId={parentId} />;+}+function renderReplyInput({onSubmit = vi.fn().mockResolvedValue("reply-new"),onAccepted,@@ -253,7 +259,7 @@ function renderReplyInput({draftKey?: `reply:${string}:${string}`;} = {}) {const view = renderWithProviders(- <ReplyInput+ <DraftReplyInputissueId="issue-1"parentId="comment-1"avatarType="member"diff --git a/packages/views/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsxindex aed5dd3543..100cdc53c7 100644--- a/packages/views/issues/components/comment-input.tsx+++ b/packages/views/issues/components/comment-input.tsx@@ -11,10 +11,11 @@ import { useShortcut } from "@multica/core/shortcuts";import { ShortcutKeycaps } from "../../common/shortcut-keycaps";import { useCommentDraftStore } from "@multica/core/issues/stores";import { composeAnnotatedReply, hasReplyIntent } from "@multica/core/drafts/reply-annotation";+import { annotationsWithPending, type AnnotationComposerSlot } from "./annotation-composer";import { ReplyAnnotations } from "./reply-annotations";import { useT } from "../../i18n";import { CommentTriggerChips } from "./comment-trigger-chips";-import { useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";+import { commentTriggerPreviewSignature, useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";import { useRecipientActions } from "../hooks/use-recipient-actions";import { SteerAttachmentNotice } from "./steer-attachment-notice";import { useStopRunsBeforeSend } from "./use-stop-runs-before-send";@@ -31,6 +32,7 @@ interface CommentInputProps {/** Called after the server accepts the comment and the composer is cleared. */onAccepted?: (commentId: string) => void;onEditAnnotation?: (id: string) => boolean;+ annotationComposer?: AnnotationComposerSlot;}// A top-level comment belongs to no thread, so it takes a running turn by@@ -39,7 +41,7 @@ function steerTopLevelByDefault(task: AgentTask): boolean {return !task.trigger_comment_id;}-function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: CommentInputProps) {+function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation, annotationComposer }: CommentInputProps) {const { t } = useT("issues");const { t: tEditor } = useT("editor");const sendShortcut = useShortcut("send");@@ -60,9 +62,10 @@ function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: Commeconst [content, setContent] = useState(initialDraft ?? "");const [isEmpty, setIsEmpty] = useState(() => !initialDraft?.trim());const annotations = useCommentDraftStore((s) => s.getAnnotations(draftKey));- const composedContent = useMemo(() => composeAnnotatedReply(content, annotations), [content, annotations]);+ const previewAnnotations = useMemo(() => annotationsWithPending(annotations, annotationComposer?.pending), [annotations, annotationComposer?.pending]);+ const composedContent = useMemo(() => composeAnnotatedReply(content, previewAnnotations), [content, previewAnnotations]);const canSend = annotations.length ? hasReplyIntent(content, annotations) : !isEmpty;- const triggerPreview = useCommentTriggerPreview({ issueId, content: canSend ? composedContent : "" });+ const triggerPreview = useCommentTriggerPreview({ issueId, content: canSend || annotationComposer?.pending.note.trim() ? composedContent : "" });// Uploads for this composer session (MUL-5181). Owned by the module-level// coordinator and persisted in the draft store, so closing/scrolling the// composer away no longer drops an in-flight upload — its result lands in the@@ -173,7 +176,8 @@ function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: Commeconst { suppressAgentIds, steerTaskIds } = routing;// A preview still catching up with an edited @mention can name a// recipient this comment no longer addresses: never stop a run on it.- const restartTaskIds = triggerPreview.isCurrent ? routing.restartTaskIds : [];+ const previewMatches = triggerPreview.isCurrent && commentTriggerPreviewSignature(content) === commentTriggerPreviewSignature(composedContent);+ const restartTaskIds = previewMatches ? routing.restartTaskIds : [];if (!(await stopRunsBeforeSend(restartTaskIds))) return false;// Flush the editor's pending debounce before snapshotting — a late flush// of pre-submit typing must not read as an edit made during the request.@@ -219,7 +223,13 @@ function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: Comme},});- return (+ return (<>+ {annotationComposer?.render({+ submit, submitting, uploading: gate.uploading, restart: routing.restartTaskIds.length > 0,+ draftContent: content, annotations,+ recipients: <CommentTriggerChips recipients={recipients} blocked={triggerPreview.blocked}+ hasAllMembersMention={triggerPreview.hasAllMembersMention} draftContent={composedContent} onActionChange={setAction} />,+ })}<div{...dropZoneProps}className="relative flex flex-col rounded-lg bg-card pb-8 ring-1 ring-border"@@ -351,7 +361,7 @@ function CommentInput({ issueId, onSubmit, onAccepted, onEditAnnotation }: Comme</div>{isDragOver && <FileDropOverlay />}</div>- );+ </>);}export { CommentInput };diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex dccdce64a0..86fe53cc60 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -1647,11 +1647,6 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trconst descriptionSourceId = `description:${id}`;const descriptionAnnotations = useCommentAnnotations({issueId: id,- reply: {- onSubmit: (_sourceId, content, suppressAgentIds, steerTaskIds) => submitComment(content, undefined, suppressAgentIds, steerTaskIds),- onAccepted: (commentId) => scrollToTimelineBottom(commentId),- steerByDefault: (task) => !task.trigger_comment_id,- },draftKey: `new:${id}`,sources: [{ id: descriptionSourceId, name: "Description", revision: issue?.revision }],enabled: !!user && !!issue,@@ -4071,6 +4066,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trkey={id}issueId={id}onSubmit={submitComment}+ annotationComposer={descriptionAnnotations.composer}onAccepted={scrollToTimelineBottom}onEditAnnotation={(annotationId) => descriptionAnnotations.editAnnotation(annotationId, true)}/>diff --git a/packages/views/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsxindex 40f8c1980d..2250c81ff2 100644--- a/packages/views/issues/components/reply-input.tsx+++ b/packages/views/issues/components/reply-input.tsx@@ -1,8 +1,10 @@"use client";import { composeAnnotatedReply, EMPTY_REPLY_ANNOTATIONS, hasReplyIntent } from "@multica/core/drafts/reply-annotation";+import { annotationsWithPending, type AnnotationComposerSlot } from "./annotation-composer";import { ReplyAnnotations } from "./reply-annotations";import { useRef, useState, useEffect, useMemo } from "react";+import { toast } from "sonner";import { ContentEditor, type ContentEditorRef, useFileDropZone, FileDropOverlay, useLazyEditor, useUploadGate, useComposerSubmit } from "../../editor";import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";import { SubmitButton } from "@multica/ui/components/common/submit-button";@@ -16,7 +18,7 @@ import { cn } from "@multica/ui/lib/utils";import type { AvatarSize } from "@multica/ui/lib/avatar-size";import { useT } from "../../i18n";import { CommentTriggerChips } from "./comment-trigger-chips";-import { useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";+import { commentTriggerPreviewSignature, useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";import { useRecipientActions } from "../hooks/use-recipient-actions";import { SteerAttachmentNotice } from "./steer-attachment-notice";import { useStopRunsBeforeSend } from "./use-stop-runs-before-send";@@ -43,6 +45,7 @@ interface ReplyInputProps {draftKey?: CommentDraftKey;targetMissing?: boolean;onEditAnnotation?: (id: string) => boolean;+ annotationComposer?: AnnotationComposerSlot;/** Whether a running turn takes this reply by default: true for the turn* that belongs to this thread. Other recipients' turns can still be chosen. */steerByDefault?: (task: AgentTask) => boolean;@@ -63,6 +66,7 @@ function ReplyInput({size = "default",draftKey,onEditAnnotation,+ annotationComposer,targetMissing = false,steerByDefault = NEVER_STEER_BY_DEFAULT,}: ReplyInputProps) {@@ -87,9 +91,12 @@ function ReplyInput({const setDraft = useCommentDraftStore((s) => s.setDraft);const [isEmpty, setIsEmpty] = useState(!initialDraft?.trim());const annotations = useCommentDraftStore((s) => draftKey ? s.getAnnotations(draftKey) : EMPTY_REPLY_ANNOTATIONS);- const composedContent = useMemo(() => composeAnnotatedReply(content, annotations), [content, annotations]);+ const previewAnnotations = useMemo(() => annotationsWithPending(annotations, annotationComposer?.pending), [annotations, annotationComposer?.pending]);+ const composedContent = useMemo(() => composeAnnotatedReply(content, previewAnnotations), [content, previewAnnotations]);const canSend = !targetMissing && (annotations.length ? hasReplyIntent(content, annotations) : !isEmpty);- const triggerPreview = useCommentTriggerPreview({ issueId, parentId, content: canSend ? composedContent : "" });+ // Saving the first pending annotation will fix the target before submission.+ const previewParentId = annotations.length === 0 ? annotationComposer?.pending.sourceCommentId ?? parentId : parentId;+ const triggerPreview = useCommentTriggerPreview({ issueId, parentId: previewParentId, content: !targetMissing && (canSend || annotationComposer?.pending.note.trim()) ? composedContent : "" });// Uploads for this reply session (MUL-5181) — owned by the coordinator. With// a draftKey they persist in the draft store so scroll-out/close no longer// drops an in-flight upload; without one (no persistence context) they fall@@ -108,7 +115,7 @@ function ReplyInput({allowSteer: true,hasAttachments,steerByDefault,- resetKey: `${issueId}:${parentId}`,+ resetKey: `${issueId}:${previewParentId}`,});const stopRunsBeforeSend = useStopRunsBeforeSend(issueId);@@ -173,10 +180,16 @@ function ReplyInput({afterAccepted: () => (editorScrubbedRef.current ? "blur" : "none"),onSubmit: async (content) => {editorScrubbedRef.current = false;+ const currentParentId = (draftKey ? useCommentDraftStore.getState().drafts[draftKey]?.replyTarget?.commentId : undefined) ?? parentId;+ if (currentParentId !== previewParentId) {+ toast.error(t(($) => $.reply.recipients_changed));+ return false;+ }const { suppressAgentIds, steerTaskIds } = routing;// A preview still catching up with an edited @mention can name a// recipient this comment no longer addresses: never stop a run on it.- const restartTaskIds = triggerPreview.isCurrent ? routing.restartTaskIds : [];+ const previewMatches = triggerPreview.isCurrent && commentTriggerPreviewSignature(content) === commentTriggerPreviewSignature(composedContent);+ const restartTaskIds = previewMatches ? routing.restartTaskIds : [];if (!(await stopRunsBeforeSend(restartTaskIds))) return false;if (draftKey) {// Flush pending debounce before snapshotting — see CommentInput.@@ -225,7 +238,13 @@ function ReplyInput({const avatarSize: AvatarSize = size === "sm" ? "sm" : "md";- return (+ return (<>+ {annotationComposer?.render({+ submit, submitting, uploading: gate.uploading, targetMissing, restart: routing.restartTaskIds.length > 0,+ draftContent: content, annotations,+ recipients: <CommentTriggerChips recipients={recipients} blocked={triggerPreview.blocked}+ hasAllMembersMention={triggerPreview.hasAllMembersMention} draftContent={composedContent} onActionChange={setAction} />,+ })}<div className="group/editor flex items-start gap-2.5"><ActorAvataractorType={avatarType}@@ -355,7 +374,7 @@ function ReplyInput({{isDragOver && <FileDropOverlay />}</div></div>- );+ </>);}export { ReplyInput, type ReplyInputProps };diff --git a/packages/views/issues/components/use-comment-annotations.test.tsx b/packages/views/issues/components/use-comment-annotations.test.tsxindex e6fbabd8e8..34eb6cafb4 100644--- a/packages/views/issues/components/use-comment-annotations.test.tsx+++ b/packages/views/issues/components/use-comment-annotations.test.tsx@@ -6,7 +6,6 @@ import { renderWithI18n } from "../../test/i18n";import { useCommentAnnotations } from "./use-comment-annotations";import { Profiler, useState } from "react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import type { AnnotationReplyOptions } from "./annotation-composer";import { toast } from "sonner";vi.mock("sonner", () => ({ toast: { error: vi.fn() } }));@@ -18,8 +17,8 @@ vi.mock("@multica/core/api", async (original) => {});vi.mock("../../editor/content-editor", async () => {const { forwardRef, useRef, useImperativeHandle } = await import("react");- return { ContentEditor: forwardRef(function Editor({ defaultValue, ariaLabel, onUpdate, onSubmit }: {- defaultValue?: string; ariaLabel?: string; onUpdate?: (value: string) => void; onSubmit?: () => void;+ return { ContentEditor: forwardRef(function Editor({ defaultValue, ariaLabel, onUpdate, onSubmit, onEnter }: {+ defaultValue?: string; ariaLabel?: string; onUpdate?: (value: string) => void; onSubmit?: () => void; onEnter?: () => void;}, ref) {const input = useRef<HTMLTextAreaElement>(null);useImperativeHandle(ref, () => ({@@ -29,6 +28,9 @@ vi.mock("../../editor/content-editor", async () => {return <textarea ref={input} aria-label={ariaLabel} defaultValue={defaultValue}onChange={(event) => onUpdate?.(event.target.value)}onKeyDown={(event) => {+ if (event.key === "Enter" && !event.shiftKey && !event.metaKey && !event.ctrlKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {+ event.preventDefault(); onEnter?.();+ }if (event.key === "Enter" && (event.metaKey || event.ctrlKey) && !event.nativeEvent.isComposing && event.keyCode !== 229) {event.preventDefault(); onSubmit?.();}@@ -40,34 +42,35 @@ vi.mock("../../editor/content-editor", async () => {const entry: TimelineEntry = { type: "comment", id: "root", actor_type: "agent", actor_id: "emacs", content: "Selected text", created_at: "2026-09-10T00:00:00Z" };const key = "reply:issue:root" as const;-function Fixture({ actorType = "agent", sourceKey = "initial", onSubmit, child = false, deleted = false }: {- actorType?: string; sourceKey?: string; onSubmit?: AnnotationReplyOptions["onSubmit"]; child?: boolean; deleted?: boolean;+function Fixture({ actorType = "agent", sourceKey = "initial", child = false, deleted = false }: {+ actorType?: string; sourceKey?: string; child?: boolean; deleted?: boolean;}) {const [client] = useState(() => new QueryClient({ defaultOptions: { queries: { retry: false } } }));const annotation = useCommentAnnotations({issueId: "issue", draftKey: key,sources: [{ id: entry.id, name: actorType }, ...(child && !deleted ? [{ id: "child", name: "Child author" }] : [])], enabled: true,- reply: onSubmit ? { onSubmit, steerByDefault: () => false } : undefined,});return <QueryClientProvider client={client}><div ref={annotation.cardRef} {...annotation.captureProps}>{annotation.popup}+ {annotation.composer?.render()}<div key={sourceKey} data-comment-content="root" tabIndex={0}>Selected text</div>{child && !deleted && <div data-comment-content="child" tabIndex={0}>Other text</div>}</div></QueryClientProvider>;}-function DescriptionFixture({ issueId = "issue", loaded = true, onSubmit }: {- issueId?: string; loaded?: boolean; onSubmit?: AnnotationReplyOptions["onSubmit"];+function DescriptionFixture({ issueId = "issue", loaded = true }: {+ issueId?: string; loaded?: boolean;}) {const [client] = useState(() => new QueryClient({ defaultOptions: { queries: { retry: false } } }));const sourceId = `description:${issueId}`;const annotations = useCommentAnnotations({- issueId, reply: onSubmit ? { onSubmit, steerByDefault: () => false } : undefined,+ issueId,draftKey: `new:${issueId}`, sources: [{ id: sourceId, name: "Description" }], enabled: loaded, editable: true,});if (!loaded) return null;return <QueryClientProvider client={client}><div ref={annotations.cardRef} {...annotations.captureProps}>{annotations.popup}+ {annotations.composer?.render()}<div data-comment-content={sourceId}><div contentEditable suppressContentEditableWarning>Selected text</div></div><button onMouseDown={(event) => event.preventDefault()} onClick={annotations.addSelection}>Add to comment</button></div></QueryClientProvider>;@@ -110,63 +113,8 @@ beforeEach(() => {});describe("selection to reply", () => {- it("sends only the selected child quote and new instruction, preserving the existing draft", async () => {- const store = useCommentDraftStore.getState();- store.setDraft(key, "Keep the overall draft");- store.addAnnotation(key, { id: "saved", sourceCommentId: "root", sourceActorName: "Root author",- quote: "Selected text", note: "Keep the first annotation", start: 0, prefix: "", suffix: "" });- const draft = useCommentDraftStore.getState().drafts[key];- const onSubmit = vi.fn(async () => "posted");- const { container } = renderWithI18n(<Fixture onSubmit={onSubmit} child />);- selectText(container, "mouse", '[data-comment-content="child"]');- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const mention = "[@Agent](mention://agent/11111111-1111-1111-1111-111111111111)";- fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: `${mention} Please revise.` } });- await waitFor(() => expect(previewCommentTriggers).toHaveBeenCalledWith("issue", `> Other text\n\n${mention} Please revise.`, "child", undefined));- fireEvent.click(screen.getByRole("button", { name: "Reply" }));- await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("child", `> Other text\n\n${mention} Please revise.`, undefined, undefined));- await waitFor(() => expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument());- expect(useCommentDraftStore.getState().drafts[key]).toBe(draft);- });-- it("previews description replies without a comment parent", async () => {- const onSubmit = vi.fn(async () => "posted");- const { container } = renderWithI18n(<DescriptionFixture onSubmit={onSubmit} />);- selectText(container);- fireEvent.click(screen.getByRole("button", { name: "Add to comment" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Please explain" } });- await waitFor(() => expect(previewCommentTriggers).toHaveBeenCalledWith("issue", "> Selected text\n\nPlease explain", undefined, undefined));- fireEvent.click(screen.getByRole("button", { name: "Post comment" }));- await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("description:issue", "> Selected text\n\nPlease explain", undefined, undefined));- });-- it("locks dismissal and duplicate submissions in flight, then keeps a failed note for retry", async () => {- let finish!: (result: boolean) => void;- const onSubmit = vi.fn(() => new Promise<boolean>((resolve) => { finish = resolve; }));- const { container } = renderWithI18n(<Fixture onSubmit={onSubmit} />);- selectText(container);- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const note = await screen.findByRole("textbox", { name: "Comment" });- fireEvent.change(note, { target: { value: "Keep on failure" } });- const send = screen.getByRole("button", { name: "Reply" });- fireEvent.click(send);- fireEvent.click(send);- fireEvent.pointerDown(document.body);- fireEvent.keyDown(note, { key: "Escape" });- await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));- expect(note).toBeInTheDocument();- expect(send).toBeDisabled();- await act(async () => { finish(false); });- expect(note).toHaveValue("Keep on failure");- expect(send).toBeEnabled();- onSubmit.mockResolvedValueOnce(true);- fireEvent.click(send);- await waitFor(() => expect(screen.queryByRole("textbox", { name: "Comment" })).not.toBeInTheDocument());- expect(onSubmit).toHaveBeenCalledTimes(2);- });-it("keeps owned portal controls open and lets their first Escape close only the nested control", async () => {- const { container } = renderWithI18n(<Fixture onSubmit={vi.fn(async () => false)} />);+ const { container } = renderWithI18n(<Fixture />);selectText(container);fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));const note = await screen.findByRole("textbox", { name: "Comment" });@@ -186,37 +134,6 @@ describe("selection to reply", () => {} finally { portal.remove(); }});- it("keeps a note visible and disables sending when its selected comment is deleted", async () => {- const onSubmit = vi.fn(async () => "posted");- const { container, rerender } = renderWithI18n(<Fixture onSubmit={onSubmit} child />);- selectText(container, "mouse", '[data-comment-content="child"]');- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- const note = await screen.findByRole("textbox", { name: "Comment" });- fireEvent.change(note, { target: { value: "Keep this instruction" } });- rerender(<Fixture onSubmit={onSubmit} child deleted />);- expect(await screen.findByRole("alert")).toHaveTextContent("reply target was deleted");- expect(note).toBeVisible();- expect(note).toHaveValue("Keep this instruction");- expect(screen.getByRole("button", { name: "Reply" })).toBeDisabled();- expect(onSubmit).not.toHaveBeenCalled();- });-- it("allows a direct reply when the batch annotation quota is full", async () => {- for (let i = 0; i < 20; i++) useCommentDraftStore.getState().addAnnotation(key, {- id: `saved-${i}`, sourceCommentId: "root", sourceActorName: "Author", quote: `Other quote ${i}`,- note: "Keep saved", start: i, prefix: "", suffix: "",- });- const onSubmit = vi.fn(async () => "posted");- const { container } = renderWithI18n(<Fixture onSubmit={onSubmit} />);- selectText(container);- fireEvent.click(await screen.findByRole("button", { name: "Add to reply" }));- fireEvent.change(await screen.findByRole("textbox", { name: "Comment" }), { target: { value: "Direct instruction" } });- expect(screen.getByRole("button", { name: "Add annotation" })).toBeDisabled();- fireEvent.click(screen.getByRole("button", { name: "Reply" }));- await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));- expect(useCommentDraftStore.getState().getAnnotations(key)).toHaveLength(20);- });-it.each([false, true])("does not rerender the host when unannotated source text changes (description: %s)", async (description) => {const onRender = vi.fn();const { container } = renderWithI18n(<Profiler id="host" onRender={onRender}>@@ -387,7 +304,7 @@ describe("selection to reply", () => {expect(useCommentDraftStore.getState().getAnnotations(draftKey)).toHaveLength(1);});- it.each([false, true])("uses the editor submit shortcut and keeps plain Enter for newlines (description: %s)", async (description) => {+ it.each([false, true])("saves on plain Enter and keeps Shift+Enter for newlines (description: %s)", async (description) => {const draftKey = description ? "new:issue" as const : key;const { container } = renderWithI18n(description ? <DescriptionFixture /> : <Fixture />);selectText(container);@@ -404,7 +321,7 @@ describe("selection to reply", () => {fireEvent.keyDown(input, { key: "Enter", keyCode: 229 });expect(input).toBeInTheDocument();fireEvent.change(input, { target: { value: "First line\nSecond line" } });- fireEvent.keyDown(input, { key: "Enter", metaKey: true });+ 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");});diff --git a/packages/views/issues/components/use-comment-annotations.tsx b/packages/views/issues/components/use-comment-annotations.tsxindex 0340fe65af..69febbda61 100644--- a/packages/views/issues/components/use-comment-annotations.tsx+++ b/packages/views/issues/components/use-comment-annotations.tsx@@ -11,13 +11,13 @@ import { MAX_ANNOTATION_QUOTE_LENGTH, MAX_REPLY_ANNOTATIONS, type ReplyAnnotatioimport { useT } from "../../i18n";import { annotationRange, captureCommentSelection, findAnnotationSource } from "./comment-annotation-selection";import { CommentSelectionBubble } from "./comment-selection-bubble";-import { AnnotationComposer, type AnnotationReplyOptions } from "./annotation-composer";+import { AnnotationComposer, type AnnotationSendControls } from "./annotation-composer";import type { ContentEditorRef } from "../../editor/content-editor";type CapturedSelection = NonNullable<ReturnType<typeof captureCommentSelection>>;type SourceAnchor = { id: string; range: Range; root: HTMLElement };-export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAdded, editable = false, reply }: {+export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAdded, onOpen, editable = false }: {issueId: string;draftKey: CommentDraftKey;sources: { id: string; name: string; revision?: number }[];@@ -25,12 +25,12 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAonAdded?: () => void;/** Editable descriptions use their existing toolbar to call addSelection. */editable?: boolean;- reply?: AnnotationReplyOptions;+ onOpen?: () => void;}) {const { t } = useT("issues");const cardRef = useRef<HTMLDivElement>(null);const inputRef = useRef<ContentEditorRef>(null);- const submittingRef = useRef(false);+ const submittingRef = useRef<string | null>(null);const pendingFocusId = useRef<string | null>(null);const actionRef = useRef<HTMLButtonElement>(null);const [selection, setSelection] = useState<CapturedSelection | null>(null);@@ -55,6 +55,8 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAannotationsRef.current = annotations;const sourcesRef = useRef(sources);sourcesRef.current = sources;+ const onOpenRef = useRef(onOpen);+ onOpenRef.current = onOpen;const onAddedRef = useRef(onAdded);onAddedRef.current = onAdded;const anchorKey = annotations.map((a) => a.id).join(",");@@ -78,7 +80,7 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAif (captured) { setSelection(captured); setEditor(null); setError(false); }};- useEffect(() => { setSelection(null); setEditor(null); setError(false); submittingRef.current = false; }, [draftKey, enabled]);+ useEffect(() => { setSelection(null); setEditor(null); setError(false); submittingRef.current = null; }, [draftKey, enabled]);// Dismiss on the next press, never on the click completing the opening drag.useEffect(() => {@@ -194,6 +196,7 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAconst element = range.startContainer instanceof Element ? range.startContainer : range.startContainer.parentElement;element?.scrollIntoView({ block: "center", behavior: "instant" });}+ onOpenRef.current?.();pendingFocusId.current = id;setSelection({ ...annotation, range, root }); setEditor({ annotation, existing: true }); setError(false);return true;@@ -214,6 +217,7 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAtoast.error(t(($) => $.reply.annotations.quote_limit, { count: MAX_ANNOTATION_QUOTE_LENGTH }));return false;}+ onOpenRef.current?.();setSelection(captured);const next = duplicate ?? {id: crypto.randomUUID(), sourceCommentId, sourceActorName: source.name,@@ -227,16 +231,16 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onA}, [t]);const addSelection = useCallback(() => add(readSelection()), [add, readSelection]);- const confirmNote = (note: string) => {- if (!editing || !note.trim()) return;+ const confirmNote = (note: string, dismiss: boolean): boolean => {+ if (!editing || !note.trim()) return false;const store = useCommentDraftStore.getState();- if (editingExisting) store.updateAnnotation(draftKey, editing.id, note);- else if (!store.addAnnotation(draftKey, { ...editing, note })) {- setError(true);- return;- }- close(true);+ const id = editingExisting ? editing.id : store.addAnnotation(draftKey, { ...editing, note });+ if (!id) { setError(true); return false; }+ store.updateAnnotation(draftKey, id, note);+ if (dismiss) close(true);+ else setEditor({ annotation: { ...editing, id, note }, existing: true });if (!editingExisting) onAddedRef.current?.();+ return true;};// Keep the pending quote identifiable without counting it as an annotation.@@ -248,10 +252,43 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAreturn () => { CSS.highlights.delete(name); };}, [enabled, selection, editingId, highlightName]);+ const renderComposer = (controls?: AnnotationSendControls) => {+ return enabled && selection ? <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote} keepVisibleWhenDetached={!!editing}>+ <div className="bubble-menu max-w-[calc(100vw-16px)] focus-within:outline-1 focus-within:outline-ring">+ {editing ? <AnnotationComposer key={editing.id} issueId={issueId} owner={draftKey}+ annotation={editing} existing={editingExisting}+ number={annotations.findIndex((a) => a.id === editing.id) + 1}+ editorRef={inputRef} controls={controls}+ sourceMissing={!sources.some((source) => source.id === editing.sourceCommentId)}+ sourceChanged={sources.some((source) => source.id === editing.sourceCommentId &&+ source.revision !== undefined && editing.sourceRevision !== undefined && source.revision !== editing.sourceRevision)}+ canSave={editingExisting || annotations.length < MAX_REPLY_ANNOTATIONS}+ onChange={(note) => { setEditor({ annotation: { ...editing, note }, existing: editingExisting }); setError(false); }}+ onSave={confirmNote} onBusyChange={(busy) => {+ if (busy && editingRef.current?.id === editing.id) submittingRef.current = editing.id;+ else if (!busy && submittingRef.current === editing.id) submittingRef.current = null;+ }}+ onRemove={editingExisting ? () => {+ useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);+ close(true);+ } : undefined} /> : <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>}+ </div>+ {error && <p role="alert" className="mt-1 max-w-72 rounded-lg bg-popover p-2 text-caption text-destructive shadow-[var(--menu-shadow)]">+ {selection.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 })}+ </p>}+ </CommentSelectionBubble> : null;+ };+return {cardRef,editAnnotation,addSelection,+ composer: editing ? { pending: editing, render: renderComposer } : undefined,captureProps: {"data-annotation-thread": draftKey,onPointerUp: (event: React.PointerEvent) => {@@ -281,37 +318,7 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onAonClick={() => editAnnotation(anchor.id)}>{index + 1}</IconButton></CommentSelectionBubble>;})}- {enabled && selection && <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote} keepVisibleWhenDetached={!!editing}>- <div className="bubble-menu max-w-[calc(100vw-16px)] focus-within:outline-1 focus-within:outline-ring">- {editing ? <AnnotationComposer key={editing.id} issueId={issueId} owner={draftKey}- annotation={editing} existing={editingExisting}- number={annotations.findIndex((a) => a.id === editing.id) + 1}- editorRef={inputRef} parentId={editable ? undefined : editing.sourceCommentId} reply={reply}- sourceMissing={!sources.some((source) => source.id === editing.sourceCommentId)}- sourceChanged={sources.some((source) => source.id === editing.sourceCommentId &&- source.revision !== undefined && editing.sourceRevision !== undefined && source.revision !== editing.sourceRevision)}- canSave={editingExisting || annotations.length < MAX_REPLY_ANNOTATIONS}- isSourceAvailable={() => sourcesRef.current.some((source) => source.id === editing.sourceCommentId) &&- !!cardRef.current && !!findAnnotationSource(cardRef.current, editing.sourceCommentId)}- onChange={(note) => { setEditor({ annotation: { ...editing, note }, existing: editingExisting }); setError(false); }}- onSave={confirmNote} onBusyChange={(busy) => {- if (editingRef.current?.id === editing.id) submittingRef.current = busy;- }}- onAccepted={() => { if (editingRef.current?.id === editing.id) close(); }}- onRemove={editingExisting ? () => {- useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);- close(true);- } : undefined} /> : <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>}- </div>- {error && <p role="alert" className="mt-1 max-w-72 rounded-lg bg-popover p-2 text-caption text-destructive shadow-[var(--menu-shadow)]">- {selection.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 })}- </p>}- </CommentSelectionBubble>}+ {!editing && renderComposer()}</>,};}diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex d17edec8a8..f3d3d00073 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -749,14 +749,13 @@"restart_failed": "Couldn't stop the current run. Your message wasn't sent."},"reply": {+ "recipients_changed": "Reply target changed. Review the recipients before sending again.","placeholder": "Leave a reply...","annotations": {- "direct_reply": "Reply",- "direct_comment": "Post comment",- "direct_target_deleted": "The reply target was deleted. Copy your note before selecting another comment.",- "copy_note": "Copy note",- "note_copied": "Note copied",- "note_copy_failed": "Could not copy note. Select and copy the text manually.",+ "send_all": "Send all",+ "send_with_annotations_and_body": "Will send with saved annotations ({{count}}) and draft text.",+ "send_with_annotations": "Will send with saved annotations ({{count}}).",+ "send_with_body": "Will send with the draft text.","confirm_add": "Add annotation","save": "Save annotation","add_comment": "Add to comment",diff --git a/packages/views/locales/es/issues.json b/packages/views/locales/es/issues.jsonindex ab41ceb627..f20120ced5 100644--- a/packages/views/locales/es/issues.json+++ b/packages/views/locales/es/issues.json@@ -732,14 +732,13 @@"restart_failed": "No se ha podido detener la ejecución actual. Tu mensaje no se envió."},"reply": {+ "recipients_changed": "El destino de la respuesta ha cambiado. Revisa los destinatarios antes de volver a enviar.","placeholder": "Deja una respuesta...","annotations": {- "direct_reply": "Responder",- "direct_comment": "Publicar comentario",- "direct_target_deleted": "Se eliminó el destino de la respuesta. Copia tu nota antes de seleccionar otro comentario.",- "copy_note": "Copiar nota",- "note_copied": "Nota copiada",- "note_copy_failed": "No se pudo copiar la nota. Selecciona y copia el texto manualmente.",+ "send_all": "Enviar todo",+ "send_with_annotations_and_body": "Se enviará con las anotaciones guardadas ({{count}}) y el texto del borrador.",+ "send_with_annotations": "Se enviará con las anotaciones guardadas ({{count}}).",+ "send_with_body": "Se enviará con el texto del borrador.","confirm_add": "Añadir anotación","save": "Guardar anotación","add_comment": "Añadir al comentario",diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex ce82427633..db17022b33 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -749,14 +749,13 @@"restart_failed": "Impossible d'arrêter l'exécution en cours. Votre message n'a pas été envoyé."},"reply": {+ "recipients_changed": "La cible de la réponse a changé. Vérifiez les destinataires avant de réessayer.","placeholder": "Laisser une réponse...","annotations": {- "direct_reply": "Répondre",- "direct_comment": "Publier le commentaire",- "direct_target_deleted": "Le commentaire ciblé a été supprimé. Copiez votre note avant de sélectionner un autre commentaire.",- "copy_note": "Copier la note",- "note_copied": "Note copiée",- "note_copy_failed": "Impossible de copier la note. Sélectionnez et copiez le texte manuellement.",+ "send_all": "Tout envoyer",+ "send_with_annotations_and_body": "Sera envoyé avec les annotations enregistrées ({{count}}) et le texte du brouillon.",+ "send_with_annotations": "Sera envoyé avec les annotations enregistrées ({{count}}).",+ "send_with_body": "Sera envoyé avec le texte du brouillon.","confirm_add": "Ajouter une annotation","save": "Enregistrer l'annotation","add_comment": "Ajouter au commentaire",diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex d3741cb94a..140941e5cc 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -727,14 +727,13 @@"restart_failed": "現在の実行を停止できませんでした。メッセージは送信されていません。"},"reply": {+ "recipients_changed": "返信先が変更されました。送信先を確認してから、もう一度送信してください。","placeholder": "返信を残す...","annotations": {- "direct_reply": "返信",- "direct_comment": "コメントを投稿",- "direct_target_deleted": "返信先が削除されました。別のコメントを選ぶ前に、意見をコピーしてください。",- "copy_note": "意見をコピー",- "note_copied": "意見をコピーしました",- "note_copy_failed": "コピーできませんでした。テキストを選択して手動でコピーしてください。",+ "send_all": "すべて送信",+ "send_with_annotations_and_body": "保存済みの注釈 {{count}} 件と下書きの本文もまとめて送信します。",+ "send_with_annotations": "保存済みの注釈 {{count}} 件もまとめて送信します。",+ "send_with_body": "下書きの本文もまとめて送信します。","confirm_add": "注釈を追加","save": "注釈を保存","add_comment": "コメントに追加",diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 31ace7316f..1e4a7e21bd 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -727,14 +727,13 @@"restart_failed": "현재 실행을 중지하지 못했습니다. 메시지는 보내지 않았습니다."},"reply": {+ "recipients_changed": "답글 대상이 변경되었습니다. 받는 사람을 확인한 뒤 다시 보내 주세요.","placeholder": "답글 남기기...","annotations": {- "direct_reply": "답글",- "direct_comment": "댓글 게시",- "direct_target_deleted": "답글 대상이 삭제되었습니다. 다른 댓글을 선택하기 전에 의견을 복사하세요.",- "copy_note": "의견 복사",- "note_copied": "의견을 복사했습니다",- "note_copy_failed": "의견을 복사하지 못했습니다. 텍스트를 선택해 직접 복사하세요.",+ "send_all": "모두 보내기",+ "send_with_annotations_and_body": "저장된 주석 {{count}}개 및 초안 본문과 함께 보냅니다.",+ "send_with_annotations": "저장된 주석 {{count}}개와 함께 보냅니다.",+ "send_with_body": "초안 본문과 함께 보냅니다.","confirm_add": "주석 추가","save": "주석 저장","add_comment": "댓글에 추가",diff --git a/packages/views/locales/ru/issues.json b/packages/views/locales/ru/issues.jsonindex 1392d5ef12..9f55795e0d 100644--- a/packages/views/locales/ru/issues.json+++ b/packages/views/locales/ru/issues.json@@ -792,14 +792,13 @@"recipient_count_many": "{{count}} агентов получат это"},"reply": {+ "recipients_changed": "Адресат ответа изменился. Проверьте получателей перед повторной отправкой.","placeholder": "Оставить ответ...","annotations": {- "direct_reply": "Ответить",- "direct_comment": "Опубликовать комментарий",- "direct_target_deleted": "Комментарий, на который вы отвечали, удалён. Скопируйте заметку, прежде чем выбрать другой комментарий.",- "copy_note": "Скопировать заметку",- "note_copied": "Заметка скопирована",- "note_copy_failed": "Не удалось скопировать заметку. Выделите и скопируйте текст вручную.",+ "send_all": "Отправить всё",+ "send_with_annotations_and_body": "Будут отправлены сохранённые аннотации ({{count}}) и текст черновика.",+ "send_with_annotations": "Будут отправлены сохранённые аннотации ({{count}}).",+ "send_with_body": "Будет отправлен и текст черновика.","confirm_add": "Добавить аннотацию","save": "Сохранить аннотацию","add_comment": "Добавить к комментарию",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex badbfe2451..e49f37437a 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -727,14 +727,13 @@"restart_failed": "没能停止当前运行,消息还没有发送。"},"reply": {+ "recipients_changed": "回复目标已变化。请重新确认接收者后再发送。","placeholder": "回复...","annotations": {- "direct_reply": "回复",- "direct_comment": "发表评论",- "direct_target_deleted": "回复目标已删除。请先复制意见,再选择其他评论。",- "copy_note": "复制意见",- "note_copied": "意见已复制",- "note_copy_failed": "复制失败,请选中意见文字手动复制。",+ "send_all": "全部发送",+ "send_with_annotations_and_body": "将连同下方 {{count}} 条批注和正文一起发送",+ "send_with_annotations": "将连同下方 {{count}} 条批注一起发送",+ "send_with_body": "将连同下方正文一起发送","confirm_add": "添加批注","save": "保存批注","add_comment": "加入评论",diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.jsonindex cf771180e1..dd257a0746 100644--- a/packages/views/locales/zh-Hant/issues.json+++ b/packages/views/locales/zh-Hant/issues.json@@ -727,14 +727,13 @@"restart_failed": "沒能停止當前執行,訊息還沒有傳送。"},"reply": {+ "recipients_changed": "回覆目標已變更。請重新確認收件者後再傳送。","placeholder": "回覆...","annotations": {- "direct_reply": "回覆",- "direct_comment": "發表評論",- "direct_target_deleted": "回覆對象已刪除。請先複製意見,再選擇其他評論。",- "copy_note": "複製意見",- "note_copied": "意見已複製",- "note_copy_failed": "複製失敗,請選取意見文字手動複製。",+ "send_all": "全部傳送",+ "send_with_annotations_and_body": "將連同下方 {{count}} 條批註和正文一起傳送",+ "send_with_annotations": "將連同下方 {{count}} 條批註一起傳送",+ "send_with_body": "將連同下方正文一起傳送","confirm_add": "新增批註","save": "儲存批註","add_comment": "加入評論",