From 57586828d9993d557c245af742e4e5a80f007617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Romero?= Date: Sat, 24 Oct 2026 22:19:04 +0200 Subject: [PATCH] fix: frame document previews like messages --- lang/da/LC_MESSAGES/flectar-mail.po | 8 +- lang/de/LC_MESSAGES/flectar-mail.po | 8 +- lang/es/LC_MESSAGES/flectar-mail.po | 8 +- lang/flectar-mail.pot | 9 +- lang/fr/LC_MESSAGES/flectar-mail.po | 8 +- lang/it/LC_MESSAGES/flectar-mail.po | 8 +- lang/ja/LC_MESSAGES/flectar-mail.po | 8 +- lang/nl/LC_MESSAGES/flectar-mail.po | 8 +- lang/ru/LC_MESSAGES/flectar-mail.po | 8 +- lang/tr/LC_MESSAGES/flectar-mail.po | 8 +- lang/zh_Hans/LC_MESSAGES/flectar-mail.po | 8 +- ui/components/document-preview.slint | 117 +++++++++++++++++---- ui/dialogs/attachment-preview-dialog.slint | 9 +- ui/views/files-view.slint | 4 +- 14 files changed, 148 insertions(+), 71 deletions(-) diff --git a/lang/da/LC_MESSAGES/flectar-mail.po b/lang/da/LC_MESSAGES/flectar-mail.po index a761d17f..b18387bf 100644 --- a/lang/da/LC_MESSAGES/flectar-mail.po +++ b/lang/da/LC_MESSAGES/flectar-mail.po @@ -2520,15 +2520,15 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3201,7 +3201,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/de/LC_MESSAGES/flectar-mail.po b/lang/de/LC_MESSAGES/flectar-mail.po index a2fcdc12..6074b4bb 100644 --- a/lang/de/LC_MESSAGES/flectar-mail.po +++ b/lang/de/LC_MESSAGES/flectar-mail.po @@ -2525,15 +2525,15 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3208,7 +3208,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/es/LC_MESSAGES/flectar-mail.po b/lang/es/LC_MESSAGES/flectar-mail.po index b1661a53..fbca186d 100644 --- a/lang/es/LC_MESSAGES/flectar-mail.po +++ b/lang/es/LC_MESSAGES/flectar-mail.po @@ -2622,15 +2622,15 @@ msgstr "Limpiar selección" msgid "Select" msgstr "Seleccionar" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "Página anterior" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "Página {} de {}" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "Página siguiente" @@ -3319,7 +3319,7 @@ msgstr "Ajustar al ancho" msgid "Download" msgstr "Descargar" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "Cargando vista previa…" diff --git a/lang/flectar-mail.pot b/lang/flectar-mail.pot index 98d8c9a0..9c0154a8 100644 --- a/lang/flectar-mail.pot +++ b/lang/flectar-mail.pot @@ -2568,15 +2568,16 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3305,7 +3306,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/fr/LC_MESSAGES/flectar-mail.po b/lang/fr/LC_MESSAGES/flectar-mail.po index af3dad1e..b1def264 100644 --- a/lang/fr/LC_MESSAGES/flectar-mail.po +++ b/lang/fr/LC_MESSAGES/flectar-mail.po @@ -3050,17 +3050,17 @@ msgstr "Effacer la sélection" msgid "Select" msgstr "Sélectionner" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 #, fuzzy msgid "Previous page" msgstr "Page précédente" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 #, fuzzy msgid "Page {} of {}" msgstr "Page {} sur {}" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 #, fuzzy msgid "Next page" msgstr "Page suivante" @@ -3879,7 +3879,7 @@ msgstr "Ajuster à la largeur" msgid "Download" msgstr "Télécharger" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 #, fuzzy msgid "Loading preview…" msgstr "Chargement de l’aperçu…" diff --git a/lang/it/LC_MESSAGES/flectar-mail.po b/lang/it/LC_MESSAGES/flectar-mail.po index 9179f053..dae9c0fb 100644 --- a/lang/it/LC_MESSAGES/flectar-mail.po +++ b/lang/it/LC_MESSAGES/flectar-mail.po @@ -2520,15 +2520,15 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3201,7 +3201,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/ja/LC_MESSAGES/flectar-mail.po b/lang/ja/LC_MESSAGES/flectar-mail.po index 1b04be08..e71d84a9 100644 --- a/lang/ja/LC_MESSAGES/flectar-mail.po +++ b/lang/ja/LC_MESSAGES/flectar-mail.po @@ -2520,15 +2520,15 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3201,7 +3201,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/nl/LC_MESSAGES/flectar-mail.po b/lang/nl/LC_MESSAGES/flectar-mail.po index dad50b1e..1d178bd1 100644 --- a/lang/nl/LC_MESSAGES/flectar-mail.po +++ b/lang/nl/LC_MESSAGES/flectar-mail.po @@ -2520,15 +2520,15 @@ msgstr "" msgid "Select" msgstr "" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "" @@ -3201,7 +3201,7 @@ msgstr "" msgid "Download" msgstr "" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "" diff --git a/lang/ru/LC_MESSAGES/flectar-mail.po b/lang/ru/LC_MESSAGES/flectar-mail.po index 731924f2..3cf10ee0 100644 --- a/lang/ru/LC_MESSAGES/flectar-mail.po +++ b/lang/ru/LC_MESSAGES/flectar-mail.po @@ -2598,15 +2598,15 @@ msgstr "Очистить выделение" msgid "Select" msgstr "Выбрать" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "Предыдущая страница" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "Страница {} из {}" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "Следующая страница" @@ -3294,7 +3294,7 @@ msgstr "По ширине" msgid "Download" msgstr "Скачать" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "Загрузка предпросмотра…" diff --git a/lang/tr/LC_MESSAGES/flectar-mail.po b/lang/tr/LC_MESSAGES/flectar-mail.po index 7afceb8f..f0795337 100644 --- a/lang/tr/LC_MESSAGES/flectar-mail.po +++ b/lang/tr/LC_MESSAGES/flectar-mail.po @@ -2563,15 +2563,15 @@ msgstr "Seçimi temizle" msgid "Select" msgstr "Seç" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "Önceki sayfa" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "Sayfa {} / {}" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "Sonraki sayfa" @@ -3255,7 +3255,7 @@ msgstr "Genişliğe sığdır" msgid "Download" msgstr "İndir" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "Önizleme yükleniyor…" diff --git a/lang/zh_Hans/LC_MESSAGES/flectar-mail.po b/lang/zh_Hans/LC_MESSAGES/flectar-mail.po index adc0655a..8f51e9de 100644 --- a/lang/zh_Hans/LC_MESSAGES/flectar-mail.po +++ b/lang/zh_Hans/LC_MESSAGES/flectar-mail.po @@ -2542,15 +2542,15 @@ msgstr "取消选择" msgid "Select" msgstr "选择" -#: ui/components/document-preview.slint:43 +#: ui/components/document-preview.slint:17 msgid "Previous page" msgstr "上一页" -#: ui/components/document-preview.slint:44 +#: ui/components/document-preview.slint:18 msgid "Page {} of {}" msgstr "第 {} 页,共 {} 页" -#: ui/components/document-preview.slint:45 +#: ui/components/document-preview.slint:19 msgid "Next page" msgstr "下一页" @@ -3228,7 +3228,7 @@ msgstr "适应宽度" msgid "Download" msgstr "下载" -#: ui/dialogs/attachment-preview-dialog.slint:53 ui/views/files-view.slint:477 +#: ui/dialogs/attachment-preview-dialog.slint:50 ui/views/files-view.slint:477 msgid "Loading preview…" msgstr "正在加载预览…" diff --git a/ui/components/document-preview.slint b/ui/components/document-preview.slint index 0976458b..ecf85871 100644 --- a/ui/components/document-preview.slint +++ b/ui/components/document-preview.slint @@ -1,9 +1,24 @@ import { HorizontalBox, VerticalBox, ScrollView } from "std-widgets.slint"; import { ZoomControls, ZoomApi } from "zoom-controls.slint"; import { ToolbarIconButton } from "controls.slint"; -import { AppTheme } from "../design-system.slint"; +import { AppTheme, LayoutMetrics } from "../design-system.slint"; import { TypeScale } from "../typography.slint"; +component PageNavigation inherits HorizontalBox { + in property compact: false; + in property busy: false; + in property page: 0; + in property pages: 0; + // A row of its own spreads the arrows to the edges. + in property fill: false; + callback render-page(int, int); + padding: 0px; spacing: 4px; cross-axis-alignment: center; + horizontal-stretch: root.fill ? 1 : 0; + ToolbarIconButton { compact: root.compact; icon-color: AppTheme.secondary; icon: @image-url("../icons/lucide/outline/chevron-left.svg"); tooltip-text: @tr("Previous page"); interactive: !root.busy && root.page > 0; clicked => { root.render-page(root.page - 1, 200); } } + Text { text: @tr("Page {} of {}", root.page + 1, root.pages); color: AppTheme.secondary; font-size: TypeScale.caption; vertical-alignment: center; horizontal-alignment: center; horizontal-stretch: root.fill ? 1 : 0; } + ToolbarIconButton { compact: root.compact; icon-color: AppTheme.secondary; icon: @image-url("../icons/lucide/outline/chevron-right.svg"); tooltip-text: @tr("Next page"); interactive: !root.busy && root.page + 1 < root.pages; clicked => { root.render-page(root.page + 1, 200); } } +} + export component DocumentPreview inherits Rectangle { in property compact: false; in property busy: false; @@ -19,7 +34,9 @@ export component DocumentPreview inherits Rectangle { private property revision: 0; private property natural-width: root.source.width / max(0.01, root.raster-zoom); private property natural-height: root.source.height / max(0.01, root.raster-zoom); - private property zoom: root.fitting ? clamp(canvas.visible-width / 1px / max(1, root.natural-width), 0.1, 3) : root.manual-zoom; + // The page sits as a sheet on the canvas, inset like the email body. + private property sheet-gap: root.compact ? 8px : 16px; + private property zoom: root.fitting ? clamp((canvas.visible-width - 2 * root.sheet-gap) / 1px / max(1, root.natural-width), 0.1, 3) : root.manual-zoom; changed document-revision => { root.fitting = true; root.manual-zoom = 1; canvas.content-x = 0px; canvas.content-y = 0px; } changed page => { canvas.content-x = 0px; canvas.content-y = 0px; } min-width: 0px; min-height: 0px; max-width: 100000px; @@ -34,27 +51,89 @@ export component DocumentPreview inherits Rectangle { canvas.content-x = 0px; canvas.content-y = 0px; } private property private-zoom: 1; + private property toolbar-inset: 10px; + private property page-button-size: root.compact ? LayoutMetrics.touch-target : LayoutMetrics.desktop-icon-button-size; + // Page navigation shares the zoom row when both fit (four 4px gaps plus + // some room between the groups), and takes its own row on narrow + // screens or with longer translations. + private property pages-below: root.pages > 0 + && zoom-controls.preferred-width + 2 * root.page-button-size + page-label-probe.preferred-width + 24px + > root.width - 2 * (LayoutMetrics.divider-width + root.toolbar-inset); + page-label-probe := Text { + visible: false; accessible-role: none; + text: @tr("Page {} of {}", root.page + 1, root.pages); font-size: TypeScale.caption; + } + // Framed like the email reader's message card: controls on top, then + // the document on the page background. + background: AppTheme.surface; + border-radius: 8px; + border-width: LayoutMetrics.divider-width; + border-color: AppTheme.border-subtle; + clip: true; VerticalBox { - width: parent.width; height: parent.height; - padding: 0px; spacing: 8px; cross-axis-alignment: stretch; - ZoomControls { compact: root.compact; zoom: root.zoom; minimum: 0.1; fitting: root.fitting; revision: root.revision; available: root.source.width > 0; command(action) => { root.command(action); } } - if root.pages > 0 : HorizontalBox { - height: root.compact ? 44px : 40px; padding: 0px; - ToolbarIconButton { compact: root.compact; icon-color: AppTheme.secondary; icon: @image-url("../icons/lucide/outline/chevron-left.svg"); tooltip-text: @tr("Previous page"); interactive: !root.busy && root.page > 0; clicked => { root.render-page(root.page - 1, 200); } } - Text { text: @tr("Page {} of {}", root.page + 1, root.pages); color: AppTheme.secondary; font-size: TypeScale.caption; vertical-alignment: center; horizontal-alignment: center; horizontal-stretch: 1; } - ToolbarIconButton { compact: root.compact; icon-color: AppTheme.secondary; icon: @image-url("../icons/lucide/outline/chevron-right.svg"); tooltip-text: @tr("Next page"); interactive: !root.busy && root.page + 1 < root.pages; clicked => { root.render-page(root.page + 1, 200); } } + x: LayoutMetrics.divider-width; y: LayoutMetrics.divider-width; + width: parent.width - 2 * LayoutMetrics.divider-width; height: parent.height - 2 * LayoutMetrics.divider-width; + padding: 0px; spacing: 0px; cross-axis-alignment: stretch; + HorizontalBox { + padding-top: 4px; padding-bottom: root.pages-below ? 0px : 4px; padding-left: root.toolbar-inset; padding-right: root.toolbar-inset; + spacing: 4px; cross-axis-alignment: center; + zoom-controls := ZoomControls { compact: root.compact; zoom: root.zoom; minimum: 0.1; fitting: root.fitting; revision: root.revision; available: root.source.width > 0; command(action) => { root.command(action); } } + Rectangle { horizontal-stretch: 1; } + if root.pages > 0 && !root.pages-below : PageNavigation { + compact: root.compact; busy: root.busy; page: root.page; pages: root.pages; + render-page(page, zoom) => { root.render-page(page, zoom); } + } } - canvas := ScrollView { + if root.pages-below : PageNavigation { + fill: true; + padding-left: root.toolbar-inset; padding-right: root.toolbar-inset; padding-bottom: 4px; + compact: root.compact; busy: root.busy; page: root.page; pages: root.pages; + render-page(page, zoom) => { root.render-page(page, zoom); } + } + Rectangle { height: LayoutMetrics.divider-width; background: AppTheme.border-subtle; } + Rectangle { vertical-stretch: 1; - mouse-drag-pan-enabled: true; - content-width: max(self.visible-width, root.natural-width * root.zoom * 1px); - content-height: max(self.visible-height, root.natural-height * root.zoom * 1px); - Image { - source: root.source; image-fit: contain; - x: max(0px, (canvas.visible-width - self.width) / 2); - width: root.natural-width * root.zoom * 1px; - height: root.natural-height * root.zoom * 1px; + background: AppTheme.page-bg; + canvas := ScrollView { + width: parent.width; height: parent.height; + mouse-drag-pan-enabled: true; + content-width: max(self.visible-width, root.natural-width * root.zoom * 1px + 2 * root.sheet-gap); + content-height: max(self.visible-height, root.natural-height * root.zoom * 1px + 2 * root.sheet-gap); + Rectangle { + x: max(root.sheet-gap, (canvas.visible-width - self.width) / 2); + y: root.sheet-gap; + width: root.natural-width * root.zoom * 1px; + height: root.natural-height * root.zoom * 1px; + Image { width: parent.width; height: parent.height; source: root.source; image-fit: contain; } + // The outline lifts the sheet off the canvas. + Rectangle { border-width: LayoutMetrics.divider-width; border-color: AppTheme.border; } + } } } } } + +// Plain-text previews share the document card. +export component TextPreview inherits Rectangle { + in property text; + in property compact: false; + private property inset: root.compact ? 12px : 16px; + min-width: 0px; min-height: 0px; + horizontal-stretch: 1; vertical-stretch: 1; + background: AppTheme.surface; + border-radius: 8px; + border-width: LayoutMetrics.divider-width; + border-color: AppTheme.border-subtle; + clip: true; + scroll := ScrollView { + x: LayoutMetrics.divider-width; y: LayoutMetrics.divider-width; + width: parent.width - 2 * LayoutMetrics.divider-width; height: parent.height - 2 * LayoutMetrics.divider-width; + content-width: self.visible-width; + content-height: body.height + 2 * root.inset; + body := Text { + x: root.inset; y: root.inset; + width: scroll.visible-width - 2 * root.inset; height: self.preferred-height; + text: root.text; wrap: word-wrap; color: AppTheme.body; font-size: TypeScale.body; + } + } +} diff --git a/ui/dialogs/attachment-preview-dialog.slint b/ui/dialogs/attachment-preview-dialog.slint index 1e9f3c06..7de5d03d 100644 --- a/ui/dialogs/attachment-preview-dialog.slint +++ b/ui/dialogs/attachment-preview-dialog.slint @@ -1,6 +1,6 @@ -import { HorizontalBox, StyleMetrics, VerticalBox, ScrollView } from "std-widgets.slint"; +import { HorizontalBox, StyleMetrics, VerticalBox } from "std-widgets.slint"; import { MailAttachments } from "../models.slint"; -import { DocumentPreview } from "../components/document-preview.slint"; +import { DocumentPreview, TextPreview } from "../components/document-preview.slint"; import { ToolbarIconButton } from "../components/controls.slint"; import { AppTheme } from "../design-system.slint"; import { TypeScale } from "../typography.slint"; @@ -46,10 +46,7 @@ export component AttachmentPreviewDialog inherits Rectangle { raster-zoom: MailAttachments.pages > 0 ? 2 : 1; document-revision: MailAttachments.revision; render-page(page, zoom) => { MailAttachments.command("page", "" + page); } } - if !MailAttachments.is-image : ScrollView { - content-width: self.visible-width; - Text { width: parent.visible-width; text: MailAttachments.text; wrap: word-wrap; color: AppTheme.body; } - } + if !MailAttachments.is-image : TextPreview { compact: root.compact; text: MailAttachments.text; } Text { text: MailAttachments.busy ? @tr("Loading preview…") : MailAttachments.status; wrap: word-wrap; color: AppTheme.secondary; } } } diff --git a/ui/views/files-view.slint b/ui/views/files-view.slint index 4050a969..90d96ab5 100644 --- a/ui/views/files-view.slint +++ b/ui/views/files-view.slint @@ -1,4 +1,4 @@ -import { DocumentPreview } from "../components/document-preview.slint"; +import { DocumentPreview, TextPreview } from "../components/document-preview.slint"; import { InfiniteScrollController } from "../components/infinite-scroll-controller.slint"; import { ScrollFade } from "../components/scroll-fade.slint"; import { HorizontalBox, VerticalBox, ListView, ScrollView, ComboBox, CheckBox } from "std-widgets.slint"; @@ -483,7 +483,7 @@ export component FilesView inherits Rectangle { document-revision: FilesUi.selected; render-page(page, zoom) => { FilesUi.command("pdf-page", "" + page, "200"); } } - if FilesUi.preview-open && !FilesUi.preview-is-image : ScrollView { vertical-stretch: 1; content-width: self.visible-width; Text { x: 0px; y: 0px; width: parent.width; height: self.preferred-height; text: FilesUi.preview-text; wrap: word-wrap; color: AppTheme.body; font-size: TypeScale.body; } } + if FilesUi.preview-open && !FilesUi.preview-is-image : TextPreview { compact: root.compact; text: FilesUi.preview-text; } if root.single-surface && FilesUi.preview-open && FilesUi.status != "" : Text { vertical-stretch: 0; text: FilesUi.status; color: AppTheme.secondary; wrap: word-wrap; font-size: TypeScale.caption; } } }