最近试了几下Django的编辑器,各有各的好处,在不使用markdown的情况下,发现ckeditor实现的比较简单,步骤如下。
$ pip install django-ckeditor
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
from ckeditor_uploader.fields import RichTextUploadingField
class Entry(models.Model):
body = RichTextUploadingField() #RichTextField()
from ckeditor.fields import RichTextField
class Post(models.Model):
content = RichTextField()
<script src="//cdn.ckeditor.com/4.5.9/standard/ckeditor.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CKEditor</title>
<script src="//cdn.ckeditor.com/4.5.9/standard/ckeditor.js"></script>
</head>
<body>
<textarea name="editor1"></textarea>
<script>
CKEDITOR.replace( 'editor1' , {uiColor: '#9AB8F3'});
</script>
</body>
</html>
http://docs.ckeditor.com/#!/guide/dev_configuration
https://python.web.id/blog/django-installing-django-ckeditor/
https://github.com/django-ckeditor/django-ckeditor
https://github.com/django-ckeditor/django-ckeditor#installation
http://cdn.ckeditor.com/
http://ckeditor.com/download