API Reference

This section provides auto-generated documentation from the library’s source code.

Fields

class editor_js.fields.EditorJSField(*args, **kwargs)[source]

Bases: JSONField

A JSONField that stores Editor.js data. It deletes the images used in the Editor.js data when the instance is deleted.

contribute_to_class(cls, name, **kwargs)[source]

Connect a post_delete signal to the model class to delete the images used in the Editor.js data when the instance is deleted.

formfield(**kwargs)[source]

Return a form field for the Editor.js data.

pre_save(model_instance, add)[source]

Delete the images that are no longer used in the Editor.js data when the instance is saved.

Widgets

class editor_js.widgets.EditorJsIframeWidget(attrs=None)[source]

Bases: Widget

class Media[source]

Bases: object

js = ('https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.min.js',)
get_context(name, value, attrs)[source]
property media
template_name = 'editor_js/admin/widgets/editor_js_widget.html'

Renderers

class editor_js.renderers.EditorJsRenderer(data, safe=True)[source]

Bases: object

escape(text)[source]
render()[source]
render_block(block)[source]
render_button(data)[source]
render_code(data)[source]
render_divider(data)[source]
render_embed(data)[source]
render_header(data)[source]
render_image(data)[source]
render_list(data)[source]
render_paragraph(data)[source]
render_quote(data)[source]
render_raw(data)[source]
render_table(data)[source]
render_unknown(data)[source]

Template Filters

editor_js.templatetags.editor_js_filters.editor_js(value)[source]

Filter that renders the Editor.js JSON using the class specified in the settings or the default class.

editor_js.templatetags.editor_js_filters.get_renderer_class()[source]

Reads the path to the renderer class from settings, otherwise returns our default class.

Utilities