How can I install plugin into CkEditor, Django

强颜欢笑 提交于 2019-12-12 21:04:08

问题


I am using 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.

But I have not any "plugins" folder in my project. There is one, but it is located in 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?


回答1:


From 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

So, put the plugin code in the static folder of your project, in static/ckeditor/ckeditor/plugins and it should work.




回答2:


Thank for your question. I just add html5audio plugin into 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.
  3. Add html5audio plugin into your settings.py near other CKEDITOR variables:
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'full',
        'extraPlugins': ','.join(
            [
               'html5audio',
            ]
        ),
    },
}

4. Reload page with ckeditor widget :).



来源:https://stackoverflow.com/questions/34541431/how-can-i-install-plugin-into-ckeditor-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!