MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

can "reset to defaults" be hooked into?

Open sharvell-collegeboard opened this issue 1 year ago • 3 comments

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

sharvell-collegeboard avatar May 02 '24 14:05 sharvell-collegeboard

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 avatar May 02 '24 21:05 dpvc