-
- Loading page...
+ @if (drawingRect(); as rect) {
+
+ }
+
+ }
+
+ @if (previewStatus === 'loading') {
+
+ }
+ } @else {
+
+
+
No sample document selected.
}
- } @else {
-
-
-
No sample document selected.
+
+ @if (previewDocId && previewStatus !== 'error') {
+
+
+
+ of {{ previewPageCount ?? '?' }}
+
+
+
+
+
+
}
diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.scss b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.scss
index 527a94bd3..f2441f5f4 100644
--- a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.scss
+++ b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.scss
@@ -6,10 +6,6 @@
max-height: 78vh;
}
-.preview-search-status {
- min-height: 1.5rem;
-}
-
.preview-page-input {
width: 3.5rem;
}
diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts
index dc9018c4b..64fb73868 100644
--- a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts
+++ b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.spec.ts
@@ -198,6 +198,24 @@ describe('OcrTemplateEditorComponent', () => {
expect(component.overlayMode).toBe('select')
})
+ it('opens the zone in the Zones tab and returns to the list', () => {
+ component.template.zones = [zone(), zone()]
+ component.activeTab = 'settings'
+
+ component.selectZone(1)
+ expect(component.activeTab).toBe('zones')
+ expect(component.selectedZone).toBe(component.template.zones[1])
+
+ component.deselectZone()
+ expect(component.selectedZone).toBeNull()
+ expect(component.activeTab).toBe('zones')
+
+ component.selectZone(0)
+ component.deleteSelectedZone()
+ expect(component.template.zones.length).toBe(1)
+ expect(component.selectedZone).toBeNull()
+ })
+
it('hides results when extraction settings or geometry change', () => {
const selected = zone()
component.template.zones = [selected]
diff --git a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts
index ea57d8ee8..7f8bb5d5d 100644
--- a/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts
+++ b/src-ui/src/app/components/manage/ocr-templates/ocr-template-editor/ocr-template-editor.component.ts
@@ -80,7 +80,7 @@ import {
resizeZone,
} from './zone-geometry'
-type ActiveTab = 'settings' | 'zones' | 'zone'
+type ActiveTab = 'settings' | 'zones'
type ZoneFieldSelection = OcrBuiltinTarget | number | null
type OverlayMode = 'select' | 'draw'
type OverlayInteraction =
@@ -438,14 +438,6 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy {
this.loadPreview()
}
- prevPage() {
- this.goToPage(this.previewPage - 1)
- }
-
- nextPage() {
- this.goToPage(this.previewPage + 1)
- }
-
zoomIn() {
this.zoom = Math.min(4, Math.round((this.zoom + 0.25) * 100) / 100)
}
@@ -819,7 +811,7 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy {
selectZone(index: number) {
this.selectedZoneIndex = index
- this.activeTab = 'zone'
+ this.activeTab = 'zones'
this.clearZoneTest()
const zone = this.template.zones[index]
if (zone) {
@@ -828,6 +820,11 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy {
}
}
+ deselectZone() {
+ this.selectedZoneIndex = null
+ this.clearZoneTest()
+ }
+
testZone() {
const zone = this.selectedZone
if (!zone || !this.previewDocId) return
@@ -896,7 +893,6 @@ export class OcrTemplateEditorComponent implements OnInit, OnDestroy {
deleteSelectedZone() {
if (this.selectedZoneIndex === null) return
this.removeZone(this.selectedZoneIndex)
- this.activeTab = 'zones'
}
save() {