简体   繁体   English

如何将插件安装到CkEditor,Django中

[英]How can I install plugin into CkEditor, Django

I am using django-ckeditor . 我正在使用django-ckeditor And now I need to add one new plugin. 现在我需要添加一个新插件。 This I have read that, I should download and extract it into "plugins" folder : 这个我看过,我应该下载并解压到“插件”文件夹:

Extract the contents of the file into the "plugins" folder of CKEditor. 将文件的内容解压缩到CKEditor的“plugins”文件夹中。

But I have not any "plugins" folder in my project. 但是我的项目中没有任何“plugins”文件夹。 There is one, but it is located in Lib\\site-packages\\ckeditor\\static\\ckeditor\\ckeditor\\plugin . 有一个,但它位于Lib\\site-packages\\ckeditor\\static\\ckeditor\\ckeditor\\plugin

So, if I add it there - it will be unavailable when I will deploy it in production or on another computer... 所以,如果我在那里添加它 - 当我将它部署到生产或另一台计算机上时它将无法使用...

And what should I do? 我该怎么办?

From this thread 这个线程

static files go into static files directory. 静态文件进入静态文件目录。 If you put plugin ins a ckeditor/ckeditor/plugins subfolder it will work. 如果你把插件插入一个ckeditor / ckeditor / plugins子文件夹它会工作。 Collectstatic will merge all files and folders and you will get typical ckeditor setup Collectstatic将合并所有文件和文件夹,您将获得典型的ckeditor设置

So, put the plugin code in the static folder of your project, in static/ckeditor/ckeditor/plugins and it should work. 因此,将插件代码放在项目的static文件夹中,在static/ckeditor/ckeditor/plugins ,它应该可以工作。

Thank for your question. 谢谢你的问题。 I just add html5audio plugin into djnago-ckeditor . 我只是将html5audio插件添加到djnago-ckeditor Full path is: 完整路径是:

  1. Download plugin from the official repo . 官方回购下载插件。
  2. Unzip html5audio directory into /path/to/your/project/static/ckeditor/ckeditor/plugins/ or /python/libs/ckeditor/static/ckeditor/ckeditor/plugins/ with all it's content. html5audio目录解压缩到/path/to/your/project/static/ckeditor/ckeditor/plugins//python/libs/ckeditor/static/ckeditor/ckeditor/plugins/及其所有内容。
  3. Add html5audio plugin into your settings.py near other CKEDITOR variables: 在其他CKEDITOR变量附近的settings.py添加html5audio插件:
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'full',
        'extraPlugins': ','.join(
            [
               'html5audio',
            ]
        ),
    },
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM