打开 https://ckeditor.com/cke4/builder 选择自己的样式后,下载后解压到 static 目录 (解压后有很多文件,全部都要;部署到正式环境要先 collectstatic)
<script src="{% static 'ckeditor_4.13.0/ckeditor.js' %}"></script>
样式风格:
官方指导文档:https://ckeditor.com/docs/ckeditor4/latest/guide/dev_framed.html
<textarea name="editor1" id="editor1"><p>Initial editor content.</p></textarea>
<script>
window.onload = function() {
CKEDITOR.replace( 'editor1' );
};
</script>
样式风格:https://ckeditor.com/ckeditor-4/demo/#inline
官方指导文档:https://ckeditor.com/docs/ckeditor4/latest/guide/dev_inline.html
<div id="comment-content" contenteditable="true">
<h1>Inline Editing in Action!</h1>
<p>The "div" element that contains this text is now editable.</p>
</div>
<script>
// Turn off automatic editor creation first.
CKEDITOR.disableAutoInline = true;
CKEDITOR.inline( 'comment-content' );
</script>
<script>
// ckeditor 获取富文本输入的内容
let comment_content = CKEDITOR.instances["comment-content"].getData();
</script>
说明:本博客评论模块的评论内容的输入框使用 CKEditor 的内联样式。