Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(editor): preserve pasted mentions in instruction editor (#2514)
Naiyuan Qing157498e9fa3f
diff --git a/packages/views/editor/content-editor.tsx b/packages/views/editor/content-editor.tsxindex 8fe6cb0299..7fb5cdea2c 100644--- a/packages/views/editor/content-editor.tsx+++ b/packages/views/editor/content-editor.tsx@@ -89,9 +89,11 @@ interface ContentEditorProps {*/currentIssueId?: string;/**- * When true, the @mention extension is not registered. Use for editors- * where mentioning members/agents has no business meaning (e.g. agent- * system prompts, where the content is fed to an LLM as plain text).+ * When true, the `@` suggestion picker is disabled but the mention node+ * type remains in the schema, so existing mentions pasted in from other+ * Multica editors still render as the normal pill. Use for editors where+ * *creating* a new mention has no business meaning (e.g. agent system+ * prompts) but *preserving* an existing one still matters.*/disableMentions?: boolean;/**diff --git a/packages/views/editor/extensions/index.ts b/packages/views/editor/extensions/index.tsindex 4d81691b1f..cf55d307a4 100644--- a/packages/views/editor/extensions/index.ts+++ b/packages/views/editor/extensions/index.ts@@ -86,11 +86,12 @@ export interface EditorExtensionsOptions {/** When true, bare Enter also submits (chat-style). Default false. */submitOnEnter?: boolean;/**- * When true, the @mention extension is not registered at all. Use for- * editors where mentioning members/agents has no business meaning (e.g.- * agent system prompts) — typing `@` becomes inert and any pre-existing- * `[@user](mention://...)` markdown renders as plain text instead of being- * parsed into a mention node.+ * When true, the `@` suggestion picker is not attached. The mention node+ * type is still registered in the schema so any mention pasted in from+ * another Multica editor renders as the normal mention pill instead of+ * being silently dropped by ProseMirror's schema check. Use for editors+ * where *creating* a new mention has no business meaning (e.g. agent+ * system prompts) but *preserving* an existing one still matters.*/disableMentions?: boolean;}@@ -128,16 +129,14 @@ export function createEditorExtensions(// so users can copy rich content out as the original Markdown.createMarkdownCopyExtension(),FileCardExtension,- ...(options.disableMentions- ? []- : [- BaseMentionExtension.configure({- HTMLAttributes: { class: "mention" },- ...(options.queryClient- ? { suggestion: createMentionSuggestion(options.queryClient) }- : {}),- }),- ]),+ BaseMentionExtension.configure({+ HTMLAttributes: { class: "mention" },+ ...(options.disableMentions+ ? { suggestion: { allow: () => false } }+ : options.queryClient+ ? { suggestion: createMentionSuggestion(options.queryClient) }+ : {}),+ }),Typography,Placeholder.configure({ placeholder: placeholderText }),createMarkdownPasteExtension(),