Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different editor not working with machina #252

Open
snehlata08 opened this issue Nov 8, 2021 · 2 comments
Open

Different editor not working with machina #252

snehlata08 opened this issue Nov 8, 2021 · 2 comments

Comments

@snehlata08
Copy link

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.
MicrosoftTeams-image (2)
And this is how it appears.
MicrosoftTeams-image (3)

@vaughnd
Copy link

vaughnd commented Jul 4, 2022

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

@josylad
Copy link

josylad commented Oct 30, 2022

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')),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants