gpt4 book ai didi

Django CKEditor 工具栏设置

转载 作者:行者123 更新时间:2023-12-04 16:27:14 28 4
gpt4 key购买 nike

我在 django 上有一个网站,在我安装 ckeditor 之前,一切都很好。它工作正常,但我无法将工具栏配置更改为“完整”。如果我在 settings.py 文件中这样写:

CKEDITOR_CONFIGS = {
'Awesome': {
'toolbar': 'Full',
'width': 900,
}}

我有一个宽度为 900px 的编辑器块,但工具栏只有 1 行和 13 个按钮,而不是 3 行和大量按钮。如果我将“完整”更改为“基本”,那么我的工具栏将减少到 3 个按钮。

我知道,我应该更改 ckeditor 文件夹中 config.js 文件中的设置,但没有工具栏设置有效。我试图制作一个迷你工具栏:
config.toolbar = 
[
[ 'Source', '-', 'Bold', 'Italic' ]
];

试图制作一个完整的工具栏:
    config.toolbar_Full =
[
{ name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
{ 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' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
];

我试图在我的项目的 settings.py 文件中删除或更改 ckeditor 的设置,每次更改后我都重新启动了服务器,但什么也没发生 =(

config.js 文件正在工作,一个可以添加隐藏工具栏的按钮
config.toolbarCanCollapse = true;

而且效果很好 =)

我该怎么做才能制作一个真正完整的工具栏 like this ?
我的大脑正在爆炸,所以如果有人帮助我,我会很高兴!
对不起我糟糕的英语......

最佳答案

我刚刚在 CKEditor 文档中找到了完整的工具栏设置:Full toolbar configuration

To create editor instance with full toolbar you don't have to set anything. Just leave toolbar and toolbarGroups with the default, null values.



所以 django-ckeditor配置将是,
CKEDITOR_CONFIGS = {
'default': {
'toolbar': None,
},
}

它有效:)

关于Django CKEditor 工具栏设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25743223/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com