EditorJS as a widget for Wagtail, with Page- and Image chooser support
Project description
wagtail_editorjs
Check out Awesome Wagtail for more awesome packages and resources from the Wagtail community.
A Wagtail EditorJS widget with page/image chooser support, document support and more!
Add features:
Quick start
-
Add 'wagtail_editorjs' to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ..., 'wagtail_editorjs', ]
-
Add the HTML to your template:
<link rel="stylesheet" href="{% static 'wagtail_editorjs/css/frontend.css' %}"> {% load editorjs %} {% editorjs self.editor_field %}
-
Add the field to your model:
... from wagtail_editorjs.fields import EditorJSField from wagtail_editorjs.blocks import EditorJSBlock class HomePage(Page): content_panels = [ FieldPanel("editor_field"), FieldPanel("content"), ] editor_field = EditorJSField( # All supported features features=[ 'attaches', 'checklist', 'code', 'delimiter', 'document', 'drag-drop', 'header', 'image', 'images', 'inline-code', 'link', 'marker', 'nested-list', 'paragraph', 'quote', 'raw', 'table', 'text-alignment-tune', 'text-variant-tune', 'underline', 'undo-redo', 'warning', ], blank=True, null=True, ) # Or as a block content = fields.StreamField([ ('editorjs', EditorJSBlock(features=[ # ... same as before ])), ], blank=True, use_json_field=True)
List features
This readme might not fully reflect which features are available.
To find this out - you can:
-
start the python shell
py ./manage.py shell
-
Print all the available features:
from wagtail_editorjs.registry import EDITOR_JS_FEATURES print(EDITOR_JS_FEATURES.keys()) dict_keys([... all registered features ...])
Settings
EDITORJS_CLEAN_HTML
Default: True
Clean the HTML output on rendering.
This happens every time the field is rendered.
It might be smart to set up some sort of caching mechanism.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wagtail_editorjs-1.4.1.tar.gz
.
File metadata
- Download URL: wagtail_editorjs-1.4.1.tar.gz
- Upload date:
- Size: 185.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc789feb8d21de16c8b4fb44f80f555d28762e359ccba4dc56e77af12801ca7d |
|
MD5 | 9d4ca03702d88665bad37c84460c0d42 |
|
BLAKE2b-256 | 182bd1e25946a1bd7e5d0a99d89aef06b1148252b98033418f9e029acbc1bfab |