Skip to content

Build your personal knowledge base with Trilium Notes

chore(ocr): improve ocr search result style

Elian Doran55ac1e01f219
diff --git a/apps/client/src/services/content_renderer.ts b/apps/client/src/services/content_renderer.ts
index 8457cbfedc..da6609e563 100644
--- a/apps/client/src/services/content_renderer.ts
+++ b/apps/client/src/services/content_renderer.ts
@@ -188,14 +188,14 @@ async function addOCRTextIfAvailable(note: FNote, $content: JQuery<HTMLElement>)
const data = await response.json();
if (data.success && data.hasOcr && data.text) {
const $ocrSection = $(`
- <div class="ocr-text-section" style="margin: 10px 0; padding: 10px; background: var(--accented-background-color); border-radius: 5px; border-left: 3px solid var(--main-text-color);">
- <div class="ocr-header" style="font-weight: bold; margin-bottom: 8px; font-size: 0.9em; color: var(--muted-text-color);">
+ <div class="ocr-text-section">
+ <div class="ocr-header">
<span class="bx bx-text"></span> ${t("ocr.extracted_text")}
</div>
- <div class="ocr-content" style="max-height: 150px; overflow-y: auto; font-size: 0.9em; line-height: 1.4; white-space: pre-wrap;"></div>
+ <div class="ocr-content"></div>
</div>
`);
-
+
$ocrSection.find('.ocr-content').text(data.text);
$content.append($ocrSection);
}
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 2296166f2f..ff49fbe380 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -2201,3 +2201,26 @@ footer.file-footer button {
content: "\ec24";
transform: rotate(180deg);
}
+
+.ocr-text-section {
+ margin: 10px 0;
+ padding: 10px;
+ background: var(--accented-background-color);
+ border-left: 3px solid var(--main-border-color);
+ text-align: left;
+}
+
+.ocr-header {
+ font-weight: bold;
+ margin-bottom: 8px;
+ font-size: 0.9em;
+ color: var(--muted-text-color);
+}
+
+.ocr-content {
+ max-height: 150px;
+ overflow-y: auto;
+ font-size: 0.9em;
+ line-height: 1.4;
+ white-space: pre-wrap;
+}
\ No newline at end of file