Add external plugin using django-ckeditor

53 Views Asked by At

I'm trying to install this details plugin for CKEditor 4, using django-ckeditor. I can't find a syntax that makes the button appear for me.

I've put the plugin folder at /static/js/lib/ckeditor-plugins/detail/. It contains a plugin.js. I can view that file in the browser at that URL.

In my Django settings.py I have this (minimal example):

CKEDITOR_CONFIGS = {
    "default": {
        "addExternal": ",".join(
            [
                "detail",
                "/static/js/lib/ckeditor-plugins/detail/",
                "plugin.js",
            ]
        ),
        "toolbar": [
            {
                "name": "paragraph",
                "groups": ["blocks"],
                "items": [
                    "Blockquote",
                    "Detail",
                ]
            }
        ]
    }
}

But there's no extra Detail button next to the Blockquote one. The Network tab of web dev tools doesn't show the plugin's plugin.js being loaded.

I've tried changing the "addExternal" to this:

        "addExternal": [
            ("detail", "/static/js/lib/ckeditor-plugins/detail/", "plugin.js"),
        ],

But it's no different. I feel I'm missing one crucial step or change.

1

There are 1 best solutions below

0
Ankit Tiwari On

According to this config you've to add plugins in extraPlugins instead of addExternal

CKEDITOR_CONFIGS = {
    "default": {
        "toolbar": [
            {
                "name": "paragraph",
                "groups": ["blocks"],
                "items": [
                    "Blockquote",
                    "Detail",
                ],
            }
        ],
        "extraPlugins": ",".join(
            [
                "detail",
            ]
        ),
    }
}

Note: Make sure you've downloaded plugin and added inside your plugin folder.