matthiask / django-prose-editor

ProseMirror-based HTML editor for Django
https://django-prose-editor.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
97 stars 6 forks source link

What do I put in the HTML head? #2

Closed bobort closed 5 months ago

bobort commented 5 months ago

I can't find what js or css files that I need to put in head of my templates to get the widgets to work. Can you update documentation with an example?

matthiask commented 5 months ago

Hi,

The widget includes all necessary JS and CSS: https://github.com/matthiask/django-prose-editor/blob/main/django_prose_editor/widgets.py (jQuery isn't necessary, I just haven't looked into ways to avoid adding the jquery.init.js dependency which is useless when using django-prose-editor outside the Django admin.)

The form media object collects JS and CSS from all widgets: https://docs.djangoproject.com/en/5.0/topics/forms/media/#media-objects

If you're rendering your form as {{ form.as_div }}` (as an example) you can output all assets using{{ form.media }}`

Documenting all this is certainly a good idea, I'll keep the issue open until I get around to documenting it properly.