romanvm / django-tinymce4-lite

TinyMCE 4 editor widget for Django
MIT License
126 stars 47 forks source link

Can't specify callback function #29

Closed ptr0x1 closed 6 years ago

ptr0x1 commented 6 years ago

Hi,

I ran into a problem where I can't add callback functions to the default config because it always returns with an error:

Uncaught TypeError: d.call is not a function
    at k.b (theme.min.js:4)
    at c.i [as fire] (tinymce.min.js:8)
    at k.fire (theme.min.js:2)
    at k.<anonymous> (theme.min.js:3)
    at c.i [as fire] (tinymce.min.js:8)
    at k.fire (theme.min.js:2)
    at HTMLDivElement.c (theme.min.js:1)
    at m (tinymce.min.js:2)
    at HTMLDivElement.y (tinymce.min.js:2)
b @ theme.min.js:4
i @ tinymce.min.js:8
fire @ theme.min.js:2
(anonymous) @ theme.min.js:3
i @ tinymce.min.js:8
fire @ theme.min.js:2
c @ theme.min.js:1
m @ tinymce.min.js:2
y @ tinymce.min.js:2

The callback function is defined as a string, and it looks like TInymce treats it as a string rather than a function which causes the problem. Am I doing something wrong?

Looks like the same issue has been fixed in django-tinyme before: https://github.com/aljosa/django-tinymce/issues/152 I'm not sure if the same thing is happening here or not.

romanvm commented 6 years ago

All JavaScript callbacks must be defined via TINYMCE_CALLBACKS config option: http://romanvm.github.io/django-tinymce4-lite/configuration.html#application-configuration

ptr0x1 commented 6 years ago

This solved it in a second, I read through the documentation multiple times but must have carefully missed this section.

Thank you! 👍