dimakorotkov / tinymce-mathjax

Tinymce plugin for MathJax
40 stars 19 forks source link

Does not work with the latest version of mathjax and tinymce #8

Closed ycgq closed 2 years ago

ycgq commented 2 years ago

I installed tinymce, mathjax and the tinymce-mathjax plugin using the commands in https://github.com/dimakorotkov/tinymce-mathjax#install. However, the mathjax button is not showing in the toolbar. Will the plugin works with the latest version of mathjax and tinymce? Thanks. Below is the script:

<!doctype html>
<html>
<head>
    <title>Mathjax</title>
    <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=3">

    <script src="node_modules/tinymce/tinymce.min.js"></script>
    <!-- <script src="node_modules/@dimakorotkov/tinymce-mathjax/config.js" type="text/javascript" charset="utf-8"></script>
    <script src="node_modules/mathjax/es5/tex-mml-chtml.js" type="text/javascript" charset="utf-8"></script> -->

    <script>
    tinymce.init({
      selector: 'textarea',
      width: 600,
      height: 260,
      toolbar_mode: 'wrap',
      external_plugins: {'mathjax': 'node_modules/@dimakorotkov/tinymce-mathjax/plugin.min.js'},
      toolbar: 'mathjax',
      mathjax: {
        lib: 'node_modules/mathjax/es5/tex-mml-chtml.js' //required path to mathjax
        // symbols: {start: '\\(', end: '\\)'}, //optional: mathjax symbols
        // className: "math-tex", //optional: mathjax element class
        // configUrl: 'node_modules/@dimakorotkov/tinymce-mathjax/config.js' //optional: mathjax config js
      }      
    });
  </script>
</head>
<body>
  <textarea>
    Welcome to TinyMCE!
  </textarea>
</body>
</html>
dimakorotkov commented 2 years ago

Hi @ycgq It works for me, check your path for the tinymce-mathjax plugin. Tinymce might retrieves it from the wrong place. It seems you should change it according to your script url. Try using something like this external_plugins: {'mathjax': '../../node_modules/@dimakorotkov/tinymce-mathjax/plugin.min.js'}

ycgq commented 2 years ago

Thanks dimakorotkov! It works now.