Skip to content

Build your personal knowledge base with Trilium Notes

feat(ocr): allow reprocessing of a file

Elian Doran6d3cff84a4a8
diff --git a/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx b/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
index 3e761c0695..308698d1d5 100644
--- a/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
+++ b/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
@@ -98,17 +98,6 @@ export default function ReadOnlyTextRepresentation({ note }: TypeWidgetProps) {
<div className="text-representation-empty">
<span className="bx bx-info-circle" />{" "}{t("ocr.no_text_available")}
</div>
- <button
- type="button"
- className="btn btn-secondary text-representation-process-btn"
- disabled={processing}
- onClick={processOCR}
- >
- {processing
- ? <><span className="bx bx-loader-alt bx-spin" />{" "}{t("ocr.processing")}</>
- : <><span className="bx bx-play" />{" "}{t("ocr.process_now")}</>
- }
- </button>
<div className="text-representation-meta">
{t("ocr.no_text_explanation")}
</div>
@@ -120,6 +109,20 @@ export default function ReadOnlyTextRepresentation({ note }: TypeWidgetProps) {
<span className="bx bx-error" />{" "}{state.message}
</div>
)}
+
+ {state.kind !== "loading" && (
+ <button
+ type="button"
+ className="btn btn-secondary text-representation-process-btn"
+ disabled={processing}
+ onClick={processOCR}
+ >
+ {processing
+ ? <><span className="bx bx-loader-alt bx-spin" />{" "}{t("ocr.processing")}</>
+ : <><span className="bx bx-play" />{" "}{t("ocr.process_now")}</>
+ }
+ </button>
+ )}
</div>
);
}