问题描述
我无法更改富文本编辑器的背景颜色。大多数地方都说要编辑 ckeditor css 文件,但我认为这不在我的 django 项目中。有没有办法在设置配置中更改它/添加样式?或者有没有更好的方法来做到这一点?
模板:
<script type="text/javascript" src="ckeditor.js">
window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';
CKEDITOR.replace( 'links' );
</script>
设置文件:
CKEDITOR_CONfigS = {
'default': {
'toolbar': 'Custom','toolbar_Custom': [
['Link','Unlink'],],'height': 200,'width': 750,'stylesSet': [
{
"name": 'Lead',"element": 'p',"attributes": {"margin-top": "10px"},},}
}
解决方法
如果您想将自定义样式和自定义类属性添加到 ck 编辑器,如果您在 Django 管理站点使用 CKEditor,则可以尝试此操作,而不必添加此操作在你的内
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow write: if request.auth != null;
allow read;
}
}
}
在config.js里面你必须替换这个
your_env/lib/python3.8/site-packages/ckeditor/static/ckeditor/ckeditor/config.js
并且您正在使用自定义管理面板而不是添加您想要使用的位置 CKEditor
CKEDITOR.editorConfig = function( config ) {
config.allowedContent = true;
config.removeFormatAttributes = '';
};
注意:如果没有任何输出,请先运行collectstatic命令,然后进行硬刷新。