使用 django-ckeditor 添加外部插件

问题描述 投票:0回答:1

我正在尝试使用 django-ckeditor 安装 CKEditor 4 的 此详细信息 插件。我找不到使该按钮为我显示的语法。

我已将插件文件夹放在

/static/js/lib/ckeditor-plugins/detail/
。它包含一个
plugin.js
。我可以在浏览器中通过该 URL 查看该文件。

在我的 Django

settings.py
我有这个(最小的例子):

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

但是 Blockquote 旁边没有额外的 Detail 按钮。 Web 开发工具的网络选项卡不显示插件的

plugin.js
正在加载。

我尝试将

"addExternal"
更改为:

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

但这并没有什么不同。我觉得我错过了一个关键的步骤或改变。

django ckeditor django-ckeditor
1个回答
0
投票

根据此config,您必须在

extraPlugins
而不是
addExternal

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

注意: 确保您已下载插件并将其添加到插件文件夹中。

© www.soinside.com 2019 - 2024. All rights reserved.