diff --git a/app/frontend/package.json b/app/frontend/package.json index ced45a4..ef55250 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -41,6 +41,7 @@ "@tiptap/extension-node-range": "3.31.4", "@tiptap/extension-table": "3.31.4", "@tiptap/extension-text-style": "3.31.4", + "@tiptap/extension-unique-id": "3.31.4", "@tiptap/extensions": "3.31.4", "@tiptap/pm": "3.31.4", "@tiptap/react": "3.31.4", diff --git a/app/frontend/src/components/NoteComments.tsx b/app/frontend/src/components/NoteComments.tsx index 5ab053f..7954d76 100644 --- a/app/frontend/src/components/NoteComments.tsx +++ b/app/frontend/src/components/NoteComments.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { timeAgo } from '@project-graphite/ui'; import { useAuth } from '../auth'; import { useAction } from '../useAction'; @@ -8,6 +8,7 @@ import { LoadError } from './LoadError'; interface NoteComment { id: string; parentId: string | null; + blockId: string | null; body: string; resolvedAt: string | null; editedAt: string | null; @@ -15,7 +16,26 @@ interface NoteComment { author: { id: string; displayName: string } | null; } -function CommentForm({ label, onSave, initial = '', onCancel }: { label: string; onSave: (body: string) => Promise; initial?: string; onCancel?: () => void }) { +export interface QuotedBlock { + id: string; + excerpt: string; +} + +const blockElement = (blockId: string) => document.querySelector(`.note-content [data-id="${CSS.escape(blockId)}"]`); + +function CommentForm({ + label, + onSave, + initial = '', + onCancel, + autoFocus, +}: { + label: string; + onSave: (body: string) => Promise; + initial?: string; + onCancel?: () => void; + autoFocus?: boolean; +}) { const [body, setBody] = useState(initial); const [busy, setBusy] = useState(false); return ( @@ -30,7 +50,7 @@ function CommentForm({ label, onSave, initial = '', onCancel }: { label: string; }); }} > -