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

can "reset to defaults" be hooked into? #3227

Open
sharvell-collegeboard opened this issue May 2, 2024 · 1 comment
Open

can "reset to defaults" be hooked into? #3227

sharvell-collegeboard opened this issue May 2, 2024 · 1 comment
Labels
Code Example Contains an illustrative code example, solution, or work-around Question v3 v4

Comments

@sharvell-collegeboard
Copy link

Is there a way to also execute custom code when the user selects the "Reset to Defaults" menu item?

@dpvc dpvc transferred this issue from mathjax/MathJax-docs May 2, 2024
@dpvc
Copy link
Member

dpvc commented May 2, 2024

Here is a configuration that you can use to hook into the reset menu:

MathJax = {
  startup: {
    ready() {
      MathJax.startup.defaultReady();
      const reset = MathJax.startup.document.menu.menu.find('Reset');
      reset.registerCallback((item) => {
        // your actions here ("item" will just be the same as "reset" in this case)
      });
    }
  }
};

This will run after all the other items that have been registered.

@dpvc dpvc added Question v3 Code Example Contains an illustrative code example, solution, or work-around v4 labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Example Contains an illustrative code example, solution, or work-around Question v3 v4
Projects
None yet
Development

No branches or pull requests

2 participants