0.资源下载 https://gitee.com/yqmc/cos-js-sdk-v5minjs-download.git
# 1. 内容方面
<form id="addEditForm" novalidate>
{% csrf_token %}
{% for field in form %}
{% if field.name == 'content' %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
<!--快速使用-->
<div id="editor">
{{ field }}
</div>
<span class="error-msg"></span>
</div>
{% else %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
<span class="error-msg"></span>
</div>
{% endif %}
{% endfor %}
<input id="id_addEditForm" type="button" class="btn btn-success" value="提交"
style="margin-top: 5px;">
</form>
# 2. 导入css
<link rel="stylesheet" href="{% static 'plugin/editor-md/css/editormd.min.css' %}">
{#全屏#}
.editormd-fullscreen {
z-index: 1001;
}
# 3. js
<script src="{% static 'plugin/editor-md/editormd.min.js' %}"></script>
$(function () {
initEditorMd();
})
function initEditorMd() {
editormd('editor', {
placeholder: "请输入内容",
height: 500,
path: "{% static 'plugin/editor-md/lib/' %}",
})
}