fix(editor): use correct getMarkdown API for @tiptap/markdown (#217)

The migration from tiptap-markdown to @tiptap/markdown in 38e92040
broke comment creation. The old package stored getMarkdown() on
editor.storage.markdown, but the official @tiptap/markdown extension
adds it directly to the editor instance (editor.getMarkdown()).

This caused getEditorMarkdown() to always return "", making the
submit button permanently disabled and preventing any comments.

Also fix stale submitting ref in useIssueTimeline dependency array.
This commit is contained in:
Bohan Jiang 2026-03-31 15:23:13 +08:00 committed by Jiang Bohan
parent 02918d8229
commit 9ceea9c17e
2 changed files with 3 additions and 3 deletions

View file

@ -203,10 +203,10 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorProps>(
const onUpdateRef = useRef(onUpdate);
const onSubmitRef = useRef(onSubmit);
// Helper to get markdown from tiptap-markdown storage
// Helper to get markdown from @tiptap/markdown extension
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getEditorMarkdown = (ed: any): string =>
ed?.storage?.markdown?.getMarkdown?.() ?? "";
ed?.getMarkdown?.() ?? "";
// Keep refs in sync without recreating editor
onUpdateRef.current = onUpdate;

View file

@ -202,7 +202,7 @@ export function useIssueTimeline(issueId: string, userId?: string) {
setSubmitting(false);
}
},
[issueId, userId, submitting],
[issueId, userId],
);
const submitReply = useCallback(