harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Move printable layout to static handling; move HTML out of template #1910

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

This makes a number of simplifying and performance-enhancing changes to reading mode. It also firmly breaks reading mode away from PagedJS/PDF rendering in favor of choices that benefit screen reading only.

This does not truly break PDF output—you can still get a file from the export button—but that file looks very primitive now. I'm going to add back in PDF-centric styles in further work.

This PR:

And lots of small-ish performance optimizations:

Lighthouse metrics before/after

Before

image image

After

image image

(The absolute numbers vary a lot between casebooks so this is more about the relative difference.)

lizadaly commented 1 year ago

Looking into that failing test; it's passing locally.

matteocargnelutti commented 1 year ago

This is excellent, @lizadaly .

Add annotations using insertAdjacentHTML rather than insertAdjacentElement (Mozilla says it's faster and my benchmarks agreed)

I would have assumed the opposite!