Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

merge: resolve conflicts with main and remote

Jiang Bohan61a34ba5cced
diff --cc apps/web/components/common/rich-text-editor.tsx
index 3ad1425259,a2df774949..d7d0436a1e
--- a/apps/web/components/common/rich-text-editor.tsx
+++ b/apps/web/components/common/rich-text-editor.tsx
@@@ -221,8 -161,46 +221,47 @@@ const RichTextEditor = forwardRef<RichT
const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);
const onUpdateRef = useRef(onUpdate);
const onSubmitRef = useRef(onSubmit);
+ const onUploadFileRef = useRef(onUploadFile);
+ // Helper to get markdown from @tiptap/markdown extension.
+ // Post-processes mention shortcodes [@ id="..." label="..."] → markdown
+ // links, using the Tiptap JSON doc for type info, in case the
+ // renderMarkdown override doesn't take effect.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const getEditorMarkdown = (ed: any): string => {
+ const md: string = ed?.getMarkdown?.() ?? "";
+ if (!md || !md.includes("[@ ")) return md;
+
+ // Build type map from editor JSON (which always has the type attr)
+ const json = ed?.getJSON?.();
+ const typeMap = new Map<string, string>();
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ function walk(node: any) {
+ if (node?.type === "mention" && node.attrs?.id) {
+ typeMap.set(node.attrs.id, node.attrs.type || "member");
+ }
+ if (node?.content) node.content.forEach(walk);
+ }
+ if (json) walk(json);
+
+ return md.replace(
+ /\[@\s+([^\]]*)\]/g,
+ (match: string, attrString: string) => {
+ const attrs: Record<string, string> = {};
+ const re = /(\w+)="([^"]*)"/g;
+ let m;
+ while ((m = re.exec(attrString)) !== null) {
+ if (m[1] && m[2] !== undefined) attrs[m[1]] = m[2];
+ }
+ const { id, label } = attrs;
+ if (!id || !label) return match;
+ const type = typeMap.get(id) || "member";
+ const display = type === "issue" ? label : `@${label}`;
+ return `[${display}](mention://${type}/${id})`;
+ },
+ );
+ };
+
// Keep refs in sync without recreating editor
onUpdateRef.current = onUpdate;
onSubmitRef.current = onSubmit;