Skip to main content

Django plugin for using Editor.js in admin

Project description

django-editorjs

GitHub version

Plugin for using Editor.js in django admin.

Supported plugins/tools

  • @editorjs/paragraph - npm version
  • @editorjs/image - npm version
  • @editorjs/header - npm version
  • @editorjs/checklist - npm version
  • @editorjs/list - npm version
  • @editorjs/quote - npm version
  • @editorjs/raw - npm version
  • @editorjs/embed - npm version
  • @editorjs/delimiter - npm version
  • @editorjs/warning - npm version
  • @editorjs/link - npm version
  • @editorjs/marker - npm version
  • @editorjs/attaches - npm version
  • @editorjs/table - npm version

⚠️ 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

TODO

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 tool ImageTool. (For more info see official documentation for tool).
    • Header - (dict) configuration for tool Header. (For more info see official documentation for tool).
    • Checklist - (dict) configuration for tool Checklist. (For more info see official documentation for tool).
    • List - (dict) configuration for tool List. (For more info see official documentation for tool).
    • Quote - (dict) configuration for tool Quote. (For more info see official documentation for tool).
    • Raw - (dict) configuration for tool RawTool. (For more info see official documentation for tool).
    • Embed - (dict) configuration for tool Embed. (For more info see official documentation for tool).
    • Delimiter - (dict) configuration for tool Delimiter. (For more info see official documentation for tool).
    • Warning - (dict) configuration for tool Warning. (For more info see official documentation for tool).
    • Link - (dict) configuration for tool LinkTool. (For more info see official documentation for tool).
    • Marker - (dict) configuration for tool Marker. (For more info see official documentation for tool).
    • Attaches - (dict) configuration for tool AttachesTool. (For more info see official documentation for tool).
    • Table - (dict) configuration for tool Table. (For more info see official documentation for tool).

API

  • EditorJsField

    Extends TextField and use EditorJsWidget as widget + have additional argument in constructor: editorjs_config.

  • EditorJsWidget

    Widget that you can to use for using Editor.js in Django.

Project details


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.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

django_editorjs-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file django-editorjs-0.1.0.tar.gz.

File metadata

  • Download URL: django-editorjs-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Darwin/18.7.0

File hashes

Hashes for django-editorjs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e3cbf56de2e59faeab5c72125f0a3860663e28c63b266b7618e30dc56552df0
MD5 60c3cfa8de82560c4943ca88b4bf49a3
BLAKE2b-256 4ee27bf4cc95bd4537e70a23c6b2610e37098ce427059bfbe3c968f7b699de14

See more details on using hashes here.

File details

Details for the file django_editorjs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_editorjs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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

Hashes for django_editorjs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07dacfee3a50b288e1e68b9c954d7c17b505688dde0b605a4a1c2d0e361022d7
MD5 cf88f04c783ae65ab89864f3da397c4d
BLAKE2b-256 cdd2a01fdd34be85cecf4a815085e06745a9947d576cb115f70df9e2c1720bfe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page