Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy extension update #777

Merged
merged 5 commits into from
Apr 6, 2022
Merged

Lazy extension update #777

merged 5 commits into from
Apr 6, 2022

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Feb 10, 2022

This PR updates the lazy-typesetting extension to add several new features.

  • The ability to typeset all untypeset math on the page before printing it (so that it will print properly, even when parts of the page haven't been viewed). (ui/lazy and printing MathJax#2711)
  • A new option to control the margin to use for the observer trigger (so that expressions slightly outside the viewport will be typeset in anticipation of scrolling.
  • The ability to mark some containers to force the math they contain to always be typeset, regardless of whether they are in the viewport. This allows math that is used in JSXgraph, for example, to be placed properly. (Lazy Typesetting vs. JSXGraph MathJax#2720)

There are also a typo in a comment that is fixed, and a redundant definition of rerender() in the MathDocument interface declaration was removed.

The three bullet points are each done in a separate commit, so it might be easier to look at them separately, rather than mixed together, as in this PR. The third is the most complicated, as there was considerably infrastructure needed to manage that. The new lazyAlwaysTypeset option is either an array of container nodes whose contents should always be typeset (non-lazily), or a single string or array of strings that represent CSS selectors for the containers to use. E.g.,

    lazyAlwaysTypeset: '.always-typeset'

would make all containers with class="always-typeset" to have their math typeset regardless of whether they appear in the viewport or not.

@dpvc dpvc requested a review from zorkow February 10, 2022 20:11
@dpvc dpvc added this to the 3.2.1 milestone Feb 22, 2022
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor issues. O/w lgtm.

ts/ui/lazy/LazyHandler.ts Outdated Show resolved Hide resolved
ts/ui/lazy/LazyHandler.ts Outdated Show resolved Hide resolved
ts/ui/lazy/LazyHandler.ts Show resolved Hide resolved
ts/ui/lazy/LazyHandler.ts Show resolved Hide resolved
dpvc and others added 2 commits February 22, 2022 13:51
@zorkow zorkow self-requested a review April 6, 2022 14:11
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

ts/ui/lazy/LazyHandler.ts Show resolved Hide resolved
ts/ui/lazy/LazyHandler.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants