diff --git a/crates/iz-web/src/detail.rs b/crates/iz-web/src/detail.rs
index 8de3fb6..72efdeb 100644
--- a/crates/iz-web/src/detail.rs
+++ b/crates/iz-web/src/detail.rs
@@ -31,7 +31,7 @@ use topcoat::router::{HeaderName, StatusCode, header, route};
use topcoat::view::{class, view};
use crate::i18n::{Key, Lang, t};
-use crate::server::{Refusal, store, back_to, mail, refusal_of, require_user, require_writer};
+use crate::server::{Refusal, back_to, mail, refusal_of, require_user, require_writer, store};
/// A task this board could be linked to: enough to name it in the picker and
/// nothing more.
@@ -417,7 +417,9 @@ async fn load_snapshot(
state_kind: state_kind.to_string(),
attempts: send.attempts,
last_error: may_administer.then(|| send.last_error.clone()).flatten(),
- sent_at: send.sent_at.map(|at| moment_label_with_seconds_in(at, zone)),
+ sent_at: send
+ .sent_at
+ .map(|at| moment_label_with_seconds_in(at, zone)),
}
})
.collect();
@@ -1168,6 +1170,7 @@ pub(crate) async fn escape_closes(cx: &Cx) -> Result {
window.__izEsc.register(90, function () { \
if (document.querySelector('.datepick-pop .edit-toggle:checked')) { return false; } \
if (document.querySelector('.viewer-scrim')) { \
+ if (document.fullscreenElement) { return true; } \
window.__izCloseViewer(); \
return true; \
} \
@@ -2478,6 +2481,9 @@ pub async fn file_viewer_modal(
+ if kind == crate::files::ViewerKind::Pdf {
+ (pdf_present_script(cx).await?)
+ }
}
}
+/// The PDF reader's presentation mode: the browser's own plugin fills the
+/// screen — its toolbar, page box and thumbnails all keep working there,
+/// which a drawn-over canvas of our own would not give. Wiring is one
+/// delegated document listener, so a soft swap that replaces the button
+/// needs no re-wire: whichever `.viewer-present` is on screen when the
+/// click lands is the one that presents. `Escape` in fullscreen is the
+/// browser's own exit gesture and never reaches the page; the guard in
+/// [`escape_closes`] covers the ones that do.
+async fn pdf_present_script(cx: &Cx) -> Result {
+ use topcoat::view::Unescaped;
+ const JS: &str = "\
+ (function () { \
+ if (window.__izPresentWired) { return; } \
+ window.__izPresentWired = true; \
+ document.addEventListener('click', function (e) { \
+ var button = e.target.closest('.viewer-present'); \
+ if (!button) { return; } \
+ var panel = button.closest('.viewer'); \
+ if (!panel || !panel.requestFullscreen) { return; } \
+ if (document.fullscreenElement) { document.exitFullscreen(); } else { panel.requestFullscreen(); } \
+ }); \
+ })();";
+ view! { cx => }
+}
+
/// One window of one sheet as a table: the tab strip when the book has more
/// than one sheet, the grid with its column letters and row numbers, and the
/// two pagers that move the window. A workbook no reader here understands
diff --git a/crates/iz-web/src/i18n.rs b/crates/iz-web/src/i18n.rs
index 0688ca3..9f2a341 100644
--- a/crates/iz-web/src/i18n.rs
+++ b/crates/iz-web/src/i18n.rs
@@ -66,6 +66,7 @@ pub enum Key {
Play,
Pause,
CloseTheFile,
+ Present,
ThisFileWillNotOpen,
Previous,
Next,
@@ -359,7 +360,6 @@ pub fn take_off_this_task(lang: Lang, name: &str) -> String {
}
}
-
/// The phrase a key names, in a user's language.
pub fn t(lang: Lang, key: Key) -> &'static str {
use Key::*;
@@ -431,6 +431,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
(Play, Tr) => "Oynat",
(Pause, En) => "Pause",
(Pause, Tr) => "Duraklat",
+ (Present, En) => "Present",
+ (Present, Tr) => "Sun",
(CloseTheFile, En) => "Close the file",
(CloseTheFile, Tr) => "Dosyayı kapat",
(ThisFileWillNotOpen, En) => "This file will not open.",
@@ -663,7 +665,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
(SenderNotConfiguredYet, En) => "No sender to test.",
(SenderNotConfiguredYet, Tr) => "Test edilecek gönderen yok.",
-
(MailRules, En) => "Mail rules",
(MailRules, Tr) => "Posta kuralları",
(EditLabel, En) => "Edit",
@@ -1032,7 +1033,6 @@ pub fn last_seen_label(lang: Lang, day: &str) -> String {
}
}
-
/// The sender panel's failed-test note, in a user's language.
pub fn not_delivered_label(lang: Lang, moment: &str, problem: &str) -> String {
match lang {
@@ -1141,9 +1141,6 @@ pub fn unblocked_label(lang: Lang, detail: &str) -> String {
}
}
-
-
-
pub fn role_changed_label(lang: Lang, detail: &str) -> String {
match lang {
Lang::En => format!("made {detail}"),
diff --git a/style/main.scss b/style/main.scss
index aca91d5..af06e14 100644
--- a/style/main.scss
+++ b/style/main.scss
@@ -1263,6 +1263,45 @@ img.avatar {
.viewer-pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-md); }
+// A PDF is the browser's own reader living in an