feat(transcription): add block-level comment threads with quote support
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 1m33s
CI / Backend Unit Tests (pull_request) Failing after 2m47s
CI / E2E Tests (pull_request) Failing after 19m44s

TranscriptionBlock.svelte:
- "Kommentieren" button opens expandable comment thread per block
- Text selection in textarea captured as quoted text (> "...") prefix
- Quote hint "Text markieren für Zitat" shown when block is active/focused
- Comment thread uses existing CommentThread with blockId prop

CommentThread.svelte:
- Add blockId prop for block-level comments URL routing
- Add quotedText prop — pre-fills comment input with markdown blockquote
- commentsBase now supports 3 URL patterns: document, annotation, block

TranscriptionEditView.svelte:
- Pass canComment + currentUserId through to block components

3 new frontend tests:
- Kommentieren button present
- Quote hint shown when active
- Quote hint hidden when inactive

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-05 21:05:39 +02:00
parent da43cadb0a
commit 8c26876345
5 changed files with 126 additions and 6 deletions

View File

@@ -8,11 +8,14 @@ afterEach(cleanup);
function renderBlock(overrides: Record<string, unknown> = {}) {
return render(TranscriptionBlock, {
blockId: 'block-1',
documentId: 'doc-1',
blockNumber: 3,
text: 'Liebe Mutter,',
label: null,
active: false,
saveState: 'idle' as const,
canComment: true,
currentUserId: 'user-1',
onTextChange: vi.fn(),
onFocus: vi.fn(),
onDeleteClick: vi.fn(),
@@ -111,4 +114,21 @@ describe('TranscriptionBlock — interactions', () => {
await textarea.click();
expect(onFocus).toHaveBeenCalled();
});
it('shows Kommentieren button that opens comment thread', async () => {
renderBlock();
const btn = page.getByText('Kommentieren');
await expect.element(btn).toBeInTheDocument();
});
it('shows quote hint when block is active', async () => {
renderBlock({ active: true });
await expect.element(page.getByText('Text markieren für Zitat')).toBeInTheDocument();
});
it('hides quote hint when block is not active', async () => {
renderBlock({ active: false });
const hint = page.getByText('Text markieren für Zitat');
await expect.element(hint).not.toBeInTheDocument();
});
});