Why Math Type WIRISplugins.js does not parse the mathml rendered in react component?

130 Views Asked by At

I am trying to render some formulas stored in the DB in mathml, in the react app i am using the plugin as suggested here: wiris. by adding to the head the tag: <script src="https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image"></script> however, the svg images are not generated and just the mathml is showing.

After this, I tried adding it using a useEffect:

    useEffect(() => {
      const script = document.createElement('script');
      script.src = 'https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image';
      document.head.appendChild(script);
    }, []);

And also did not work at first, but when i change the document.head.appendChild(script); line to document.body.appendChild(script); the HMR fires and that moment the WIRISplugins.js works and convert the mathml into images. but if i do a manual reload it again stop working.

0

There are 0 best solutions below