pypi地址
CKEDITOR_IMAGE_BACKEND = "pillow" # 图片
# 上传文件夹
CKEDITOR_UPLOAD_PATH = 'upload/'
UPLOAD_DIR_NAME = 'upload'
UPLOAD_DIR = os.path.join(BASE_DIR, UPLOAD_DIR_NAME) # 路径
if not os.path.exists(UPLOAD_DIR):
os.mkdir(UPLOAD_DIR)
CKEDITOR_CONFIGS = {
'default': {
'language': 'zh-cn',
'image_previewText': ' ', # 替换上传图片时显示区域出现的字符串
'tabSpaces': 8,
'toolbar': (
['Source', 'Save', 'NewPage', 'Preview', 'Templates'],
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'Print', 'SpellChecker', 'Scayt'],
['Undo', 'Redo', 'Find', 'Replace', 'SelectAll', 'RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'],
['NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
['Styles', 'Format', 'Font', 'FontSize'],
['TextColor', 'BGColor', 'lineheight'],
['Maximize', 'ShowBlocks', 'About', 'pbckcode'],
),
'extraPlugins': ','.join(['lineheight'])
}
}
给插件添加行距
在Ckeditor
的文件夹修改其配置文件config.js
并保存为utf-8
格式
/**
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.extraPlugins += (config.extraPlugins ? ',lineheight' : 'lineheight'); //添加行距插件
config.font_names='宋体/宋体;仿宋/仿宋;微软雅黑/微软雅黑;楷体/楷体;黑体/黑体;'+ config.font_names; //字体添加
};
在plugins
文件夹下解压放入行距插件文件夹