Py学习  »  问与答

请问如何使用django-ckeditor添加自定义的plugins

VA • 10 年前 • 7423 次点击  

各位, 我通过pip install django-ckeditor-updated 下载安装了django-ckeditor,发现他的插件是CKEditor提供的Full的套装,我想自定义添加需要的一些模块,比如code snippet,这个插件在它提供的包里没有,于是我通过CKEditor的网站重新build了一个ckeditor,然后在我的static文件夹里替换了原来的ckeditor,但是仍然无法加载code snippet。

我的settings.py里的相关的设置:

CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'

CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'full',
    },
    'basic': {
        'toolbar': 'Basic',
    },
    'customized': {
        'extraPlugins': "codesnippet",
        'toolbar': [["Source"],
                    ["Format", "Font", "Bold", "Italic", "Underline", "Strike", "Subscript", "Superscript", "SpellChecker"],
                    ['Undo', 'Redo'],
                    ['NumberedList', 'BulletedList'],
                    ["Indent", "Outdent", 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
                    ["Link", "Unlink", "Anchor"],
                    ["codesnippet", "Smiley", "Image", "Table"],
                    ["Maximize"]
                    ],
    },
}

目录结构如下:

project
└─static
    └─ckeditor
        ├─ckeditor
              ├─adapter
              ├─lang
              ├─plugins
                    ├─codesnippet
                           ├─dialogs
                           └─lib
                             └─highlight
                                   └─styles

在ckeditor/ckeditor/config.js里面添加了

CKEDITOR.editorConfig = function( config ) {
    config.extraPlugins = 'codesnippet';
};

也没有用,求点拨,谢谢

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/846
 
7423 次点击  
文章 [ 3 ]  |  最新文章 10 年前