tinymce integration
Closed this issue · 2 comments
Hi there,
i've been wondering how you got adminfiles to work so nicely with a wysiwyg editor in the video -
i tried doing this to get it working with tinymce
class NoticiasAdmin(FilePickerAdmin):
prepopulated_fields = { 'slug' : ['titulo']}
adminfiles_fields = ('texto')
class Media:
js = ('js/tiny_mce/tiny_mce.js', 'js/textareas.js')
Both the tinymce field and the adminfiles show up fine, but when i try to insert an uploaded image into the text nothing happens
Thanks for the awesome tool!hope i can get it to work!
adminfiles isn't really designed for use with a WYSIWYG editor like tinymce that works in raw HTML and renders on the client side. It inserts adminfiles-specific slugs that have to be rendered into HTML on the server side using the render_uploads template tag or function. The reason it does this is so that content references can be kept up to date when uploaded files are changed (in particular this can be an issue if MEDIA_URL ever changes for any reason - if raw HTML were stored, all upload references would be broken).
The editor shown in the video is MarkItUp!, which does its live preview via an AJAX request to the server, so the server can render the content into HTML, including the adminfiles slugs.
I wouldn't be opposed to enabling a mode of operation that inserts raw HTML directly, for use with TinyMCE and similar editors, but it doesn't match my use case so I'm not likely to write the code myself. Sorry if this means adminfiles won't work for you!
Thanks for the prompt response!
I figured what you are telling me after a bit of research and turned to the filebrowser instead, since I'm creating a cms for computer illiterate people.