如何移除Django Admin中CKEditor版本不安全的更新提示?
移除Django CKEditor版本安全提示的解决方案
当前使用Django CKEditor 6.7.0时,RichTextUploadingField中出现的CKEditor版本不安全提示,是由CKEditor内置的updatechecker插件触发的。之前尝试的ignoreUpdates、updateCheck配置项已在新版CKEditor中失效,CKEDITOR_UPDATE_NOTIFICATION设置也不适用于当前版本的Django CKEditor,正确的解决方法是直接移除该插件:
- 在
settings.py的CKEDITOR_CONFIGS配置中,为default配置添加removePlugins项,指定移除updatechecker插件:
CKEDITOR_CONFIGS = { "default": { "skin": "moono", "toolbar": "Custom", "allowedContent": True, "extraAllowedContent": "object[id,name,width,height];", "extraPlugins": "iframe", # 添加这行代码移除更新检查插件 "removePlugins": "updatechecker", "iframe_attributes": { "sandbox": "allow-scripts allow-same-origin allow-popups allow-presentation allow-forms", "allowfullscreen": "", "loading": "lazy", "referrerpolicy": "no-referrer-when-downgrade", }, "toolbar_Custom": [ { "name": "document", "items": [ "Source", "-", "Save", "NewPage", "Preview", "Print", "-", "Templates", ], }, { "name": "clipboard", "items": [ "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Undo", "Redo", ], }, {"name": "editing", "items": ["Find", "Replace", "-", "SelectAll"]}, { "name": "forms", "items": [ "Form", "Checkbox", "Radio", "TextField", "Textarea", "Select", "Button", "ImageButton", "HiddenField", ], }, "/", { "name": "basicstyles", "items": [ "Bold", "Italic", "Underline", "Strike", "Subscript", "Superscript", "-", "RemoveFormat", ], }, { "name": "paragraph", "items": [ "NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote", "CreateDiv", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock", "-", "BidiLtr", "BidiRtl", "Language", ], }, {"name": "links", "items": ["Link", "Unlink", "Anchor"]}, { "name": "insert", "items": [ "Image", "Flash", "Table", "HorizontalRule", "Smiley", "SpecialChar", "PageBreak", "Iframe", "Embed", ], }, "/", { "name": "styles", "items": ["Styles", "Format", "Font", "FontSize"], }, {"name": "colors", "items": ["TextColor", "BGColor"]}, {"name": "tools", "items": ["Maximize", "ShowBlocks"]}, { "name": "about", "items": [ "About", ], }, ], "language": "en", } }
- 保存
settings.py后,重启Django服务,刷新Admin页面即可看到提示已消失。
内容的提问来源于stack exchange,提问作者Ksarvin
相关产品推荐
相关产品推荐

