===
# 介绍 #
本项目整合了新版 [CKEditor 5](https://ckeditor.com/ckeditor-5/) 到Django. 老版本[django-ckeditor](https://github.com/django-ckeditor/django-ckeditor) 仍然在使用[CKEditor 4](https://ckeditor.com/ckeditor-4/).
根据 [ckeditor.com](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/migrate.html)官方说明,CKEditor 5是一个你没有用过的船新版本。
整体上仍然使用 [django-ckeditor](https://github.com/django-ckeditor/django-ckeditor/tree/master/ckeditor)项目的架构。不同点是:
- `static/ckeditor5` 包含最新的CKEditor 5经典编辑器(版本会随时更新,尽量与官方同步),[CKEditor 5下载](https://ckeditor.com/ckeditor-5/download/).
- 移除了`extraPlugins`,老的一些插件,如代码插入编辑,目前不可以使用,需要其他方案。
- 修改了`static/ckeditor5/ckeditor-init.js`部分代码, 在 `initialiseCKEditor` 方法里:
+ extraPlugins处理方法代码被删除
+ CKEditor 5 使用 `ClassicEditor.create` 来初始化创建编辑器,而不是用4的 `CKEDITOR.replace`
# 安装 #
pip install django-ckeditor5
升级
pip install django-ckeditor5 -U
github
pip install git+https://github.com/n37r06u3/django-ckeditor5
# 配置 #
添加app
```
INSTALLED_APPS = [
...
'ckeditor5'
]
```
基础配置
```
CKEDITOR5_CONFIGS = {
'default': {
'toolbar': ["undo", "redo", "bold", "italic", "blockQuote", "imageTextAlternative", "imageUpload", "heading",
"imageStyle:full", "imageStyle:side", "link", "numberedList", "bulletedList"],
'height': '300px',
'width': '100%',
},
}
```
模型定义
```
from ckeditor5.fields import RichTextField
```
添加插件
https://www.npmjs.com/package/ckeditor5-code-block
# 测试 #
下载源码解压
cd ckeditor5_demo
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
http://127.0.0.1:8000/admin/
# 参考 #
https://github.com/django-ckeditor/django-ckeditor
https://ckeditor.com/ckeditor-4/
https://github.com/pancodia/django-ckeditor5
https://ckeditor.com/ckeditor-5/
# 变更 #
20190304 - v0.0.1 初始化项目 CKEditor 5集成v11.0.1, 新版本django2.1.7测试可用
20190305 - v0.0.2 添加demo
20190306 - v0.0.3 添加大小配置
20190306 - v0.0.4 ckeditor5-build-classic11.0.1到v12.0.0 添加 https://www.npmjs.com/package/ckeditor5-code-block
# TODO #
添加图片上传插件
添加html源码查看插件
完善安装说明
Metadata
Release files for django-ckeditor5 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_ckeditor5-0.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_ckeditor5-0.0.4-py2.py3-none-any.whl |
Release files / django_ckeditor5-0.0.4-py2.py3-none-any.whl
| Download URL | django_ckeditor5-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 921.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
56725d9fde45cc7c161e6df38005949adf93fe7c44c31e808359b530c943f6c6
|
|
BLAKE2b-256 checksum How to use checksums |
2833c57d87a6cb98e7467eaa95c37556998749f40d033d9531ac40d4bb7be3aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.4
|
Security for django-ckeditor5 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.