Commit Graph

11 Commits

Author SHA1 Message Date
claude 200bff4ecb feat(typst): browser-side live preview via typst.ts WASM
Build and Deploy Verso / deploy (push) Successful in 12m51s
Adds a dual-mode Typst preview: a new "Live (browser)" mode compiles and
renders Typst documents entirely in-browser using typst.ts WASM (28 MB
compiler + 1 MB renderer). The existing server-side PDF mode is preserved
and selectable via a new "Preview mode" section in the recompile dropdown,
visible only for Typst projects.

Architecture:
- Web Worker (typst-preview-worker.ts) runs the WASM compiler; queues
  compile requests so only the latest compile runs after each keypress
- TypstWasmPreview component initialises the renderer on the main thread,
  listens to changedAt from the compile context, debounces at 400 ms, and
  renders SVG into a container div via renderToSvg
- typstPreviewMode ('wasm'|'pdf') is persisted per-project in localStorage
- isTypstProject, changedAt, typstPreviewMode, setTypstPreviewMode are
  exposed through both LocalCompileContext and DetachCompileContext
- Fonts loaded from jsDelivr CDN (text subset only) on first use
- Phase 1: single-file Typst only (no #include, no images)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 13:42:39 +00:00
claude 489bdb01ec feat(pdf): dark mode for Quarto RevealJS HTML output
Build and Deploy Verso / deploy (push) Successful in 10m36s
Apply the same CSS inversion filter to the HTML iframe as is already
applied to pdfjs PDF pages, so Quarto RevealJS presentations respect
the dark mode toggle. Also show the theme button for HTML outputs and
relax the darkModePdf condition to activate for iframes regardless of
the pdfViewer setting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 17:18:29 +00:00
Alf Eaton 34d272afa9 Reapply "Wrap PDF setDocument in startViewTransition (#33346)" (#33633)
GitOrigin-RevId: 11dc65d8a8195c8cd6e6e2b58905a0f8b7b218f4
2026-05-20 08:06:53 +00:00
Alf Eaton 64d706f114 Revert "Wrap PDF setDocument in startViewTransition (#33346)" (#33580)
This reverts commit 353ab865de3c7872363a61592d86390dfc34dacc.

GitOrigin-RevId: dd103eb413a51861b31cd77542ca541e10df0c6c
2026-05-12 08:06:05 +00:00
Alf Eaton 17dd108ce1 Wrap PDF setDocument in startViewTransition (#33346)
* Set scale synchronously on pagesinit to prevent 1.333 DPI flash

PDF.js resets its internal scale to 1.0 when setDocument() is called,
causing pages to momentarily render at the default 96/72 DPI scale
(1.333) before the React restore effect can apply the correct value.
Setting currentScaleValue directly in the pagesinit handler eliminates
this one-frame wrong-scale flash.

* Override .page display to block to prevent horizontal jump on recompile

Overleaf's global .loading class sets display:inline-flex, which
collides with PDF.js's transient 'loading' class on .page elements.
When the loading class is applied, inline-flex breaks margin:auto
centering, causing the page to jump horizontally. Forcing display:block
at higher specificity prevents the global rule from taking effect.

* Fix scrollToPosition offset using marginTop instead of borderWidth

scrollPageIntoView aligns the page content edge with the container top,
leaving scrollTop equal to the page's top margin (12px) rather than 0.
The previous correction used borderWidth (effectively 0) so the margin
offset was never compensated. Using marginTop scrolls back the correct
amount so the margin above the first page is visible.

* Prevent PDF viewer collapsing during recompile by preserving height

When setDocument() is called with a new PDF, _resetView() synchronously
clears all page elements, briefly collapsing the .pdfViewer div to the
viewport height. This produces a visible flicker before pagesinit fires
and pages are re-added.

Fix: record the current height and pin it as min-height on the .pdfViewer
element before calling setDocument(). A one-shot pagesinit listener
removes the constraint once the new pages are initialised at the correct
scale, by which point the element is already at its correct final height.

* Suppress PDF.js page-level loading spinner in Overleaf viewer

The PDF.js loadingIcon/loading classes briefly add a ::after pseudo-element
with display:block and contain:strict to each page div. Overleaf has its
own loading state UI so the spinner is redundant, and its activation was
the root cause of the shifts 4-5 height oscillation (the display change
broke CSS margin collapse on .pdfViewer, adding 2x page margins to its
computed height).

The display:block rule already added to .page prevents the direct cause
(Overleaf's .loading{display:inline-flex} colliding with the PDF.js class).
This rule makes the intent explicit by zeroing the ::after entirely.

* Wrap PDF setDocument in startViewTransition

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: 353ab865de3c7872363a61592d86390dfc34dacc
2026-05-12 08:05:53 +00:00
Mathias Jakobsen c46fba951e [web] Re-introduce orphan detection in detached PDF (#32994)
GitOrigin-RevId: 07a58d6f7e3c6db8465c62b390e34270c2b4fd67
2026-04-27 08:05:42 +00:00
Mathias Jakobsen 3407f59b23 Merge pull request #31885 from overleaf/mj-avoid-browser-default-input-bgs
[web] Specify background colors of input fields

GitOrigin-RevId: 8fbdddfe73840b75503ea8ab32ca6887cf43146f
2026-03-06 09:10:47 +00:00
Davinder Singh 84cdbfc12f Tearing down of Error Logs and pdf preview in editor (#31267)
GitOrigin-RevId: 05b2c980d874de801ffcdadb57dd9da9d983225c
2026-02-11 09:06:38 +00:00
Alf Eaton ce5f66c21b Add keyboard shortcuts for Layout actions (#30494)
GitOrigin-RevId: 7978a579e719c4cd593c02662406e364b19f87e0
2026-01-09 09:05:56 +00:00
Mathias Jakobsen 4186321ed7 [web] Add dark mode setting to PDF viewer (#29813)
GitOrigin-RevId: 4eddfac30a934c44b451694fd5e18dd8d26ad910
2025-11-26 09:05:51 +00:00
Rebeka Dekany 3f11776ecd Remove LESS stylesheets and dependencies (#27409)
* Remove components, core and modules LESS stylesheets

* Remove variables LESS stylesheets

* Remove app LESS stylesheets

* Remove github-sync, onboarding LESS stylesheets

* Remove main-light and IEEE LESS stylesheets

* Remove Less loader configuration

* Remove bootstrap-3 entrypoint

* Rename bootstrap-5 entrypoint to bootstrap

* Remove bootstrap-5 CSS folder and move stylesheets

* Update CSS variables

* Restore and update github-sync.scss path

* Fix try-premium.scss path and fix undefined mixin error

* Restore entrypoints

* Simplify buildCssPath to always use main-style.css

* Remove less from prettier formatting scripts

* Remove less from addHook extension

* Source format

* Remove nvd3 file reference from prettierignore (equivalent of nvd3.scss)

* Remove less and less-loader

* Add SCSS files to pirates require hook

GitOrigin-RevId: bd83c79f4d6ef7305d75993959a4dc5e7714ef9c
2025-08-06 08:05:38 +00:00