FriendsOfSymfony / FOSCKEditorBundle

Provides a CKEditor integration for your Symfony project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mathjx support

napestershine opened this issue · comments

commented

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

Thanks

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'
commented

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

commented

image

@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:

  • Put 's' on plugin --> plugins
  • Put the correct indentation on plugins: and following lines
  • I´m not sure if the path should start with slash or not ('/bundles/fos...' or 'bundles/fos..')
commented
  default_config: default
  configs:
    default:
      filebrowserBrowseRoute: elfinder
      filebrowserBrowseRouteParameters: []
      extraPlugins:
        - 'mathjax'
  plugins:
    mathjx:
      path: 'bundles/fosckeditor/plugins/mathjax/'
      filename: 'plugin.js'```

@napestershine Yup, it works?

commented

Nope. With this config I am getting console errors.

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

commented

Yes I have plugin there. I shared error in screenshot

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

commented

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

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';

commented

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