django-machina
django-machina copied to clipboard
Different editor not working with machina
I replaced the markdown editor of machina with ckeditor using ckeditor javascript file. The content posted with that is not proper.
Its removing all the html tags from the final output. Image upload also not working. Can anyone tell me the correct way to implement ckeditor with machina.
This is what the content that i post.
And this is how it appears.
Did you follow this recipe? https://django-machina.readthedocs.io/en/stable/customization/recipes/using_another_markup_language.html
I used the Quill editor, and had to use these two settings and this function: MACHINA_MARKUP_LANGUAGE = ('xxx.views.utils.quill_html', {'safe_mode': True}) MACHINA_MARKUP_WIDGET = 'django_quill.widgets.QuillWidget'
def quill_html(json, safe_mode=True):
if "delta" in json:
html = Quill(json).html
log.info("Rendering quill_html with json: %s = %s", json, html)
return html
else:
return json
Not entirely sure how safe_mode is used, but it looks like it's just passed to markdown2 to handle in the default MACHINA_MARKUP_LANGUAGE here: https://github.com/ellmetha/django-machina/blob/main/machina/core/markdown.py#L6
Add this to your project settings file
MACHINA_MARKUP_LANGUAGE = None
MACHINA_MARKUP_WIDGET = 'ckeditor.widgets.CKEditorWidget'
Also, Add CKEditor URL include to your project's urls.py
file:
path('ckeditor/', include('ckeditor_uploader.urls')),