Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vlzh/django-editorjs
Widget of editor.js for django admin
https://github.com/vlzh/django-editorjs
django django-admin editor editorjs
Last synced: 3 months ago
JSON representation
Widget of editor.js for django admin
- Host: GitHub
- URL: https://github.com/vlzh/django-editorjs
- Owner: VLZH
- License: mit
- Created: 2020-07-18T22:14:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-05T18:05:15.000Z (about 4 years ago)
- Last Synced: 2024-08-08T20:53:38.247Z (6 months ago)
- Topics: django, django-admin, editor, editorjs
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 29
- Watchers: 5
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-editorjs
[](https://badge.fury.io/gh/VLZH%2Fdjango-editorjs)
[](https://pypi.org/project/django-editorjs/)Plugin for using [Editor.js](https://editorjs.io/) in django admin.
# Supported plugins/tools
- `@editorjs/paragraph` - [](https://badge.fury.io/js/%40editorjs%2Fparagraph)
- `@editorjs/image` - [](https://badge.fury.io/js/%40editorjs%2Fimage)
- `@editorjs/header` - [](https://badge.fury.io/js/%40editorjs%2Fheader)
- `@editorjs/checklist` - [](https://badge.fury.io/js/%40editorjs%2Fchecklist)
- `@editorjs/list` - [](https://badge.fury.io/js/%40editorjs%2Flist)
- `@editorjs/quote` - [](https://badge.fury.io/js/%40editorjs%2Fquote)
- `@editorjs/raw` - [](https://badge.fury.io/js/%40editorjs%2Fraw)
- `@editorjs/embed` - [](https://badge.fury.io/js/%40editorjs%2Fembed)
- `@editorjs/delimiter` - [](https://badge.fury.io/js/%40editorjs%2Fdelimiter)
- `@editorjs/warning` - [](https://badge.fury.io/js/%40editorjs%2Fwarning)
- `@editorjs/link` - [](https://badge.fury.io/js/%40editorjs%2Flink)
- `@editorjs/marker` - [](https://badge.fury.io/js/%40editorjs%2Fmarker)
- `@editorjs/attaches` - [](https://badge.fury.io/js/%40editorjs%2Fattaches)
- `@editorjs/table` - [](https://badge.fury.io/js/%40editorjs%2Ftable)> #### ⚠️ 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
```bash
pip install django-editorjs
```# Simple example
```python
# models.py
from django.db import models
from django_editorjs import EditorJsFieldclass 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
```python
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.
# 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