Django plugin for using Editor.js in admin
Project description
django-editorjs
Plugin for using Editor.js in django admin.
Supported plugins/tools
@editorjs/paragraph
-@editorjs/image
-@editorjs/header
-@editorjs/checklist
-@editorjs/list
-@editorjs/quote
-@editorjs/raw
-@editorjs/embed
-@editorjs/delimiter
-@editorjs/warning
-@editorjs/link
-@editorjs/marker
-@editorjs/attaches
-@editorjs/table
-
⚠️ Note (for plugin configuration)
Usually in examples for Editor.js you will see tool names starts with lowercase, but for bypass potential conflicts i use uppercase.
Installation
pip install django-editorjs
Simple example
# models.py
from django.db import models
from django_editorjs import EditorJsField
class Post(models.Model):
title = models.CharField(max_length=255)
body = EditorJsField()
def __str__(self):
return self.title
How to configure
You can provide field specific configuration options to EditorJsField
by argument editorjs_config
.
Example
class Post(models.Model):
title = models.TextField()
body = EditorJsField(
editorjs_config={
"tools": {
"Table": {
"disabled": False,
"inlineToolbar": True,
"config": {"rows": 2, "cols": 3,},
}
}
}
)
Config schema
tools
Image
- (dict
) configuration for toolImageTool
. (For more info see official documentation for tool).Header
- (dict
) configuration for toolHeader
. (For more info see official documentation for tool).Checklist
- (dict
) configuration for toolChecklist
. (For more info see official documentation for tool).List
- (dict
) configuration for toolList
. (For more info see official documentation for tool).Quote
- (dict
) configuration for toolQuote
. (For more info see official documentation for tool).Raw
- (dict
) configuration for toolRawTool
. (For more info see official documentation for tool).Embed
- (dict
) configuration for toolEmbed
. (For more info see official documentation for tool).Delimiter
- (dict
) configuration for toolDelimiter
. (For more info see official documentation for tool).Warning
- (dict
) configuration for toolWarning
. (For more info see official documentation for tool).Link
- (dict
) configuration for toolLinkTool
. (For more info see official documentation for tool).Marker
- (dict
) configuration for toolMarker
. (For more info see official documentation for tool).Attaches
- (dict
) configuration for toolAttachesTool
. (For more info see official documentation for tool).Table
- (dict
) configuration for toolTable
. (For more info see official documentation for tool).
API
-
EditorJsField
Extends
TextField
and useEditorJsWidget
as widget + have additional argument in constructor:editorjs_config
. -
EditorJsWidget
Widget that you can to use for using Editor.js in Django.
TODO
- load tool on demand
- more examples in README.md
- view-function for file uploading
- view-function for image uploading
- view-function for link info crawler
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
django-editorjs-0.1.1.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file django-editorjs-0.1.1.tar.gz
.
File metadata
- Download URL: django-editorjs-0.1.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.7.7 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c74974a06924f4e15154276dc7a4fd1662043519ec52ebc724665ff32ef14b2 |
|
MD5 | d13bf87f017a2bc4df178392841561c1 |
|
BLAKE2b-256 | 9956b7d0e0ddba6e4e5326a5a5908530bf6d63779e0fa0acaac997cd50b7380c |
File details
Details for the file django_editorjs-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: django_editorjs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.7.7 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7608f6c6d4bf3ec703880bbd3b4df4e39dd7e2b259395d1ddb15eb2ebd113b6 |
|
MD5 | 3618d9c6e6d93ebb4218dff6ffe7c63e |
|
BLAKE2b-256 | b66c77875b2733e41e111c6d92004531252c0d25c1eb389bbe47cbdfface97cf |