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.5.6.tar.gz
.
File metadata
- Download URL: wagtail_editorjs-1.5.6.tar.gz
- Upload date:
- Size: 193.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fa4798e86d6e50cf9062f7716d83fd751d2e7704705d2f80fc6a1979ccb81a |
|
MD5 | f459882c380e77a16256f9a1d1e6545a |
|
BLAKE2b-256 | ec3adf626df0a56ce320e0f81d1ed15c89262074b4e2df0fce14875e5c4941dd |