FriendsOfSymfony / FOSCKEditorBundle

Provides a CKEditor integration for your Symfony project.
Other
518 stars 83 forks source link

Mathjx support #197

Closed napestershine closed 4 years ago

napestershine commented 5 years ago

How can I use Mathjax https://ckeditor.com/cke4/addon/mathjax, in FOSCkeditor ?

Thanks

Julen10 commented 5 years ago

You have to download the zip, unzip it into public/bundles/fosckeditor/plugins/ and change the config/packages/fos_ckeditor.yml adding this:

fos_ckeditor:
    default_config: simple_config
        configs:
            simple_config:
                extraPlugins:
                    - 'mathjax'
             plugins:
                mathjax:
                    path: 'bundles/fosckeditor/plugins/mathjax/'
                    filename: 'plugin.js'
napestershine commented 5 years ago

Hi @Julen10

here is my config:

fos_ck_editor:
    default_config: default
    configs:
        default:
            filebrowserBrowseRoute: elfinder
            filebrowserBrowseRouteParameters: []
            extraPlugins:
                - 'mathjax'
            plugin:
                mathjx:
                    path: 'bundles/fosckeditor/plugins/mathjax/'
                    filename: 'plugin.js'

is it right?

Thanks

napestershine commented 5 years ago

image

Julen10 commented 5 years ago

@napestershine i have made a mistake, here is how your config should look like:

fos_ck_editor:
    default_config: default
    configs:
        default:
            filebrowserBrowseRoute: elfinder
            filebrowserBrowseRouteParameters: []
            extraPlugins:
                - 'mathjax'
    plugins:
        mathjx:
            path: 'bundles/fosckeditor/plugins/mathjax/'
            filename: 'plugin.js'

You should change:

napestershine commented 5 years ago

  default_config: default
  configs:
    default:
      filebrowserBrowseRoute: elfinder
      filebrowserBrowseRouteParameters: []
      extraPlugins:
        - 'mathjax'
  plugins:
    mathjx:
      path: 'bundles/fosckeditor/plugins/mathjax/'
      filename: 'plugin.js'```
Julen10 commented 5 years ago

@napestershine Yup, it works?

napestershine commented 5 years ago

Nope. With this config I am getting console errors.

Julen10 commented 5 years ago

Share the errors. Do you have the plugin under public/bundles/fosckeditor/plugins/mathjax ?

napestershine commented 5 years ago

Yes I have plugin there. I shared error in screenshot

Julen10 commented 5 years ago

The configuration is correct, but you have to add another property more "mathJaxLib", you have the info here. https://ckeditor.com/docs/ckeditor4/latest/guide/dev_errors.html#mathjax-no-config

napestershine commented 5 years ago

I tried it, but I am not sure where should I add it?

Julen10 commented 5 years ago

I don´t really know, but try it under fosckeditor: mathJaxLib: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML';

napestershine commented 5 years ago

@Julen10 I have tried all options, but doesn't seems to work, can you try it once in your end?