feat(ui): manual-first OCR workflow — remove full-page auto-segmentation
Drawing annotations is now the primary workflow. OCR only runs on manually drawn regions (guided mode always). Full-page layout detection and the useExistingAnnotations checkbox are removed entirely. - OcrTrigger: guided-only, disabled with hint when no annotations exist - TranscriptionEditView: empty state shows draw-regions instruction, OCR trigger moved out of collapsible and shown inline after block list - i18n: add ocr_trigger_no_annotations, ocr_section_heading, transcription_empty_draw_hint; remove ocr_use_existing_annotations keys Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -479,6 +479,7 @@
|
|||||||
"scan_collapse": "Scan verkleinern",
|
"scan_collapse": "Scan verkleinern",
|
||||||
"transcription_empty_title": "Noch keine Transkription",
|
"transcription_empty_title": "Noch keine Transkription",
|
||||||
"transcription_empty_desc": "Zeichne Bereiche auf dem Scan und tippe den Text ab, um eine Transkription zu erstellen.",
|
"transcription_empty_desc": "Zeichne Bereiche auf dem Scan und tippe den Text ab, um eine Transkription zu erstellen.",
|
||||||
|
"transcription_empty_draw_hint": "Zeichnen Sie Bereiche auf dem Dokument, um mit der Transkription zu beginnen.",
|
||||||
"transcription_panel_close": "Panel schließen",
|
"transcription_panel_close": "Panel schließen",
|
||||||
"person_alias_heading": "Namensverlauf",
|
"person_alias_heading": "Namensverlauf",
|
||||||
"person_alias_empty": "Noch keine Namensaenderungen erfasst.",
|
"person_alias_empty": "Noch keine Namensaenderungen erfasst.",
|
||||||
@@ -530,8 +531,8 @@
|
|||||||
"ocr_status_analyzing_page": "Seite {current} von {total} wird analysiert…",
|
"ocr_status_analyzing_page": "Seite {current} von {total} wird analysiert…",
|
||||||
"ocr_status_done_skipped": "{count} Blöcke erstellt, {skipped} Seite(n) übersprungen",
|
"ocr_status_done_skipped": "{count} Blöcke erstellt, {skipped} Seite(n) übersprungen",
|
||||||
"ocr_status_error": "OCR fehlgeschlagen",
|
"ocr_status_error": "OCR fehlgeschlagen",
|
||||||
"ocr_use_existing_annotations": "Nur annotierte Bereiche",
|
"ocr_trigger_no_annotations": "Zeichnen Sie zuerst Bereiche auf dem Dokument ein.",
|
||||||
"ocr_use_existing_annotations_hint": "OCR wird nur innerhalb der bereits markierten Bereiche ausgeführt — keine neue Layout-Erkennung.",
|
"ocr_section_heading": "OCR ausführen",
|
||||||
"transcription_block_review": "Als geprüft markieren",
|
"transcription_block_review": "Als geprüft markieren",
|
||||||
"transcription_block_unreview": "Markierung aufheben",
|
"transcription_block_unreview": "Markierung aufheben",
|
||||||
"transcription_reviewed_count": "{reviewed} von {total} geprüft",
|
"transcription_reviewed_count": "{reviewed} von {total} geprüft",
|
||||||
|
|||||||
@@ -479,6 +479,7 @@
|
|||||||
"scan_collapse": "Collapse scan",
|
"scan_collapse": "Collapse scan",
|
||||||
"transcription_empty_title": "No transcription yet",
|
"transcription_empty_title": "No transcription yet",
|
||||||
"transcription_empty_desc": "Draw regions on the scan and type the text to create a transcription.",
|
"transcription_empty_desc": "Draw regions on the scan and type the text to create a transcription.",
|
||||||
|
"transcription_empty_draw_hint": "Draw regions on the document to start transcribing.",
|
||||||
"transcription_panel_close": "Close panel",
|
"transcription_panel_close": "Close panel",
|
||||||
"person_alias_heading": "Name history",
|
"person_alias_heading": "Name history",
|
||||||
"person_alias_empty": "No name changes recorded yet.",
|
"person_alias_empty": "No name changes recorded yet.",
|
||||||
@@ -530,8 +531,8 @@
|
|||||||
"ocr_status_analyzing_page": "Analyzing page {current} of {total}…",
|
"ocr_status_analyzing_page": "Analyzing page {current} of {total}…",
|
||||||
"ocr_status_done_skipped": "{count} blocks created, {skipped} page(s) skipped",
|
"ocr_status_done_skipped": "{count} blocks created, {skipped} page(s) skipped",
|
||||||
"ocr_status_error": "OCR failed",
|
"ocr_status_error": "OCR failed",
|
||||||
"ocr_use_existing_annotations": "Annotated regions only",
|
"ocr_trigger_no_annotations": "Draw regions on the document first.",
|
||||||
"ocr_use_existing_annotations_hint": "OCR runs only within the already marked regions — no new layout detection.",
|
"ocr_section_heading": "Run OCR",
|
||||||
"transcription_block_review": "Mark as reviewed",
|
"transcription_block_review": "Mark as reviewed",
|
||||||
"transcription_block_unreview": "Unmark as reviewed",
|
"transcription_block_unreview": "Unmark as reviewed",
|
||||||
"transcription_reviewed_count": "{reviewed} of {total} reviewed",
|
"transcription_reviewed_count": "{reviewed} of {total} reviewed",
|
||||||
|
|||||||
@@ -479,6 +479,7 @@
|
|||||||
"scan_collapse": "Reducir escaneo",
|
"scan_collapse": "Reducir escaneo",
|
||||||
"transcription_empty_title": "Sin transcripcion",
|
"transcription_empty_title": "Sin transcripcion",
|
||||||
"transcription_empty_desc": "Dibuja regiones en el escaneo y escribe el texto para crear una transcripcion.",
|
"transcription_empty_desc": "Dibuja regiones en el escaneo y escribe el texto para crear una transcripcion.",
|
||||||
|
"transcription_empty_draw_hint": "Dibuje regiones en el documento para comenzar a transcribir.",
|
||||||
"transcription_panel_close": "Cerrar panel",
|
"transcription_panel_close": "Cerrar panel",
|
||||||
"person_alias_heading": "Historial de nombres",
|
"person_alias_heading": "Historial de nombres",
|
||||||
"person_alias_empty": "Aun no se han registrado cambios de nombre.",
|
"person_alias_empty": "Aun no se han registrado cambios de nombre.",
|
||||||
@@ -530,8 +531,8 @@
|
|||||||
"ocr_status_analyzing_page": "Analizando página {current} de {total}…",
|
"ocr_status_analyzing_page": "Analizando página {current} de {total}…",
|
||||||
"ocr_status_done_skipped": "{count} bloques creados, {skipped} página(s) omitida(s)",
|
"ocr_status_done_skipped": "{count} bloques creados, {skipped} página(s) omitida(s)",
|
||||||
"ocr_status_error": "OCR fallido",
|
"ocr_status_error": "OCR fallido",
|
||||||
"ocr_use_existing_annotations": "Solo regiones anotadas",
|
"ocr_trigger_no_annotations": "Dibuje regiones en el documento primero.",
|
||||||
"ocr_use_existing_annotations_hint": "El OCR se ejecuta solo dentro de las regiones ya marcadas — sin nueva detección de diseño.",
|
"ocr_section_heading": "Ejecutar OCR",
|
||||||
"transcription_block_review": "Marcar como revisado",
|
"transcription_block_review": "Marcar como revisado",
|
||||||
"transcription_block_unreview": "Desmarcar como revisado",
|
"transcription_block_unreview": "Desmarcar como revisado",
|
||||||
"transcription_reviewed_count": "{reviewed} de {total} revisados",
|
"transcription_reviewed_count": "{reviewed} de {total} revisados",
|
||||||
|
|||||||
@@ -1,67 +1,38 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { untrack } from 'svelte';
|
|
||||||
import { m } from '$lib/paraglide/messages.js';
|
import { m } from '$lib/paraglide/messages.js';
|
||||||
import { getConfirmService } from '$lib/services/confirm.svelte';
|
|
||||||
import ScriptTypeSelect from './ScriptTypeSelect.svelte';
|
import ScriptTypeSelect from './ScriptTypeSelect.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
existingBlockCount: number;
|
blockCount: number;
|
||||||
storedScriptType: string;
|
storedScriptType: string;
|
||||||
annotationCount?: number;
|
|
||||||
onTrigger: (scriptType: string, useExistingAnnotations: boolean) => void;
|
onTrigger: (scriptType: string, useExistingAnnotations: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { existingBlockCount, storedScriptType, annotationCount = 0, onTrigger }: Props = $props();
|
let { blockCount, storedScriptType, onTrigger }: Props = $props();
|
||||||
|
|
||||||
const { confirm } = getConfirmService();
|
|
||||||
|
|
||||||
|
import { untrack } from 'svelte';
|
||||||
let selectedScriptType: string = $state(
|
let selectedScriptType: string = $state(
|
||||||
untrack(() => (storedScriptType && storedScriptType !== 'UNKNOWN' ? storedScriptType : ''))
|
untrack(() => (storedScriptType && storedScriptType !== 'UNKNOWN' ? storedScriptType : ''))
|
||||||
);
|
);
|
||||||
|
|
||||||
let useExistingAnnotations: boolean = $state(false);
|
function handleClick() {
|
||||||
|
|
||||||
async function handleClick() {
|
|
||||||
if (!selectedScriptType) return;
|
if (!selectedScriptType) return;
|
||||||
|
onTrigger(selectedScriptType, true);
|
||||||
if (!useExistingAnnotations && existingBlockCount > 0) {
|
|
||||||
const confirmed = await confirm({
|
|
||||||
title: m.ocr_confirm_title(),
|
|
||||||
body: m.ocr_confirm_body({ count: String(existingBlockCount) }),
|
|
||||||
confirmLabel: m.ocr_confirm_btn(),
|
|
||||||
destructive: true
|
|
||||||
});
|
|
||||||
if (!confirmed) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
onTrigger(selectedScriptType, useExistingAnnotations);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col gap-3">
|
<div class="flex flex-col gap-3">
|
||||||
<ScriptTypeSelect bind:value={selectedScriptType} />
|
<ScriptTypeSelect bind:value={selectedScriptType} />
|
||||||
{#if annotationCount > 0}
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<label class="flex cursor-pointer items-center gap-2">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
bind:checked={useExistingAnnotations}
|
|
||||||
class="h-4 w-4 cursor-pointer rounded-sm border-brand-navy/30 accent-brand-navy"
|
|
||||||
/>
|
|
||||||
<span class="font-sans text-sm font-medium text-brand-navy">
|
|
||||||
{m.ocr_use_existing_annotations()}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
<p class="pl-6 text-xs text-ink-3">{m.ocr_use_existing_annotations_hint()}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!selectedScriptType}
|
disabled={!selectedScriptType || blockCount === 0}
|
||||||
title={!selectedScriptType ? m.ocr_trigger_btn_disabled() : undefined}
|
title={!selectedScriptType ? m.ocr_trigger_btn_disabled() : undefined}
|
||||||
onclick={handleClick}
|
onclick={handleClick}
|
||||||
class="min-h-[44px] w-full rounded-sm bg-brand-navy font-sans text-sm font-medium text-white transition-colors hover:bg-brand-navy/90 disabled:cursor-not-allowed disabled:opacity-50"
|
class="min-h-[44px] w-full rounded-sm bg-brand-navy font-sans text-sm font-medium text-white transition-colors hover:bg-brand-navy/90 disabled:cursor-not-allowed disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{m.ocr_trigger_btn()}
|
{m.ocr_trigger_btn()}
|
||||||
</button>
|
</button>
|
||||||
|
{#if blockCount === 0}
|
||||||
|
<p class="text-xs text-ink-3">{m.ocr_trigger_no_annotations()}</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -361,21 +361,18 @@ $effect(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if canRunOcr && onTriggerOcr}
|
{#if canRunOcr && onTriggerOcr}
|
||||||
<details class="mt-6">
|
<div class="mt-6">
|
||||||
<summary
|
<p class="mb-3 font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
|
||||||
class="cursor-pointer font-sans text-xs font-medium text-ink-3 transition-colors hover:text-brand-navy"
|
{m.ocr_section_heading()}
|
||||||
>
|
</p>
|
||||||
{m.ocr_rerun_label()}
|
<div class="max-w-xs">
|
||||||
</summary>
|
|
||||||
<div class="mt-3 max-w-xs">
|
|
||||||
<OcrTrigger
|
<OcrTrigger
|
||||||
existingBlockCount={blocks.length}
|
blockCount={blocks.length}
|
||||||
annotationCount={blocks.length}
|
|
||||||
storedScriptType={storedScriptType}
|
storedScriptType={storedScriptType}
|
||||||
onTrigger={onTriggerOcr}
|
onTrigger={onTriggerOcr}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -395,25 +392,9 @@ $effect(() => {
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
{#if canRunOcr && onTriggerOcr}
|
<p class="max-w-xs text-sm leading-relaxed text-ink-3">
|
||||||
<p class="mb-6 max-w-xs text-sm leading-relaxed text-ink-3">
|
{m.transcription_empty_draw_hint()}
|
||||||
{m.transcription_empty_title()}
|
</p>
|
||||||
</p>
|
|
||||||
<div class="w-full max-w-xs">
|
|
||||||
<OcrTrigger
|
|
||||||
existingBlockCount={0}
|
|
||||||
storedScriptType={storedScriptType}
|
|
||||||
onTrigger={onTriggerOcr}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<p class="mt-4 text-xs text-ink-3">
|
|
||||||
{m.transcription_empty_desc()}
|
|
||||||
</p>
|
|
||||||
{:else}
|
|
||||||
<p class="max-w-xs text-sm leading-relaxed text-ink-3">
|
|
||||||
{m.transcription_empty_cta()}
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ function renderView(overrides: Record<string, unknown> = {}, service = createCon
|
|||||||
onBlockFocus: vi.fn(),
|
onBlockFocus: vi.fn(),
|
||||||
onSaveBlock: vi.fn(),
|
onSaveBlock: vi.fn(),
|
||||||
onDeleteBlock: vi.fn(),
|
onDeleteBlock: vi.fn(),
|
||||||
|
onReviewToggle: vi.fn(),
|
||||||
...overrides
|
...overrides
|
||||||
},
|
},
|
||||||
context: new Map([[CONFIRM_KEY, service]])
|
context: new Map([[CONFIRM_KEY, service]])
|
||||||
|
|||||||
Reference in New Issue
Block a user