feat(ocr): allow re-running OCR when transcription blocks already exist

Add a collapsible OCR trigger below the block list in edit mode.
Uses a <details> element so it's unobtrusive — the primary workflow
is editing existing blocks, but users can expand to re-run OCR with
a confirmation dialog that warns about replacing existing blocks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-13 10:37:51 +02:00
parent 69768a104d
commit 3fe6eedffb
4 changed files with 20 additions and 0 deletions

View File

@@ -515,6 +515,7 @@
"ocr_confirm_title": "Vorhandene Transkription ersetzen?",
"ocr_confirm_body": "Alle {count} vorhandenen Blöcke werden gelöscht und durch die OCR-Ergebnisse ersetzt. Diese Aktion kann nicht rückgängig gemacht werden.",
"ocr_confirm_btn": "Ersetzen",
"ocr_rerun_label": "OCR erneut ausführen…",
"ocr_progress_heading": "OCR läuft",
"ocr_progress_page": "Seite {current} von {total}",
"ocr_error_heading": "OCR fehlgeschlagen",

View File

@@ -515,6 +515,7 @@
"ocr_confirm_title": "Replace existing transcription?",
"ocr_confirm_body": "All {count} existing blocks will be deleted and replaced with OCR results. This action cannot be undone.",
"ocr_confirm_btn": "Replace",
"ocr_rerun_label": "Re-run OCR…",
"ocr_progress_heading": "OCR running",
"ocr_progress_page": "Page {current} of {total}",
"ocr_error_heading": "OCR failed",

View File

@@ -515,6 +515,7 @@
"ocr_confirm_title": "¿Reemplazar transcripción existente?",
"ocr_confirm_body": "Los {count} bloques existentes serán eliminados y reemplazados con los resultados del OCR. Esta acción no se puede deshacer.",
"ocr_confirm_btn": "Reemplazar",
"ocr_rerun_label": "Ejecutar OCR de nuevo…",
"ocr_progress_heading": "OCR en curso",
"ocr_progress_page": "Página {current} de {total}",
"ocr_error_heading": "OCR fallido",

View File

@@ -318,6 +318,23 @@ $effect(() => {
>
{m.transcription_next_block_cta({ number: sortedBlocks.length + 1 })}
</div>
{#if canRunOcr && onTriggerOcr}
<details class="mt-6">
<summary
class="cursor-pointer font-sans text-xs font-medium text-ink-3 transition-colors hover:text-brand-navy"
>
{m.ocr_rerun_label()}
</summary>
<div class="mt-3 max-w-xs">
<OcrTrigger
existingBlockCount={blocks.length}
storedScriptType={storedScriptType}
onTrigger={onTriggerOcr}
/>
</div>
</details>
{/if}
</div>
{:else}
<div class="flex flex-1 flex-col items-center justify-center px-6 py-12 text-center">