如何将插件安装到 CkEditor,Django

How can I install plugin into CkEditor, Django

我正在使用 django-ckeditor. And now I need to add one new plugin. This 我已经读过,我应该下载并将其解压缩到 "plugins" 文件夹中:

Extract the contents of the file into the "plugins" folder of CKEditor.

但我的项目中没有任何 "plugins" 文件夹。有一个,但它位于 Lib\site-packages\ckeditor\static\ckeditor\ckeditor\plugin

因此,如果我将它添加到那里 - 当我将它部署到生产环境或另一台计算机上时它将不可用...

那我该怎么办?

来自 this thread

static files go into static files directory. If you put plugin ins a ckeditor/ckeditor/plugins subfolder it will work. Collectstatic will merge all files and folders and you will get typical ckeditor setup

因此,将插件代码放在项目的 static 文件夹中,在 static/ckeditor/ckeditor/plugins 中,它应该可以工作。

感谢您的提问。我只是将 html5audio 插件添加到 djnago-ckeditor 中。完整路径是:

  1. official repo 下载插件。
  2. html5audio 目录及其所有内容解压到 /path/to/your/project/static/ckeditor/ckeditor/plugins//python/libs/ckeditor/static/ckeditor/ckeditor/plugins/ 中。
  3. html5audio 插件添加到 settings.py 其他 CKEDITOR 变量附近:
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'full',
        'extraPlugins': ','.join(
            [
               'html5audio',
            ]
        ),
    },
}

4。使用 ckeditor 小部件重新加载页面 :).