在 CKEditor 中加载块引用插件

Load blockquote plugin in CKEditor

本文关键字:引用 插件 加载 CKEditor      更新时间:2023-09-26

我想通过django-ckeditor使用CKEditor。

CKEditor被加载,但我无法加载blockquote插件。

  • 我下载了blockquote.zip,解压缩了它
  • 像这样将其复制到我的应用程序中myapp/static/ckeditor/ckeditor/plugins/blockquote
  • 我跑collectstatic.如果我手动插入 URL,我可以通过浏览器访问块引用/插件.js文件。
  • 我更新了配置:

    CKEDITOR_CONFIGS = { "默认":{ 'extraPlugins': 'blockquote', }}

  • HTML 包含以下blockquote<textarea cols="40" id="id_body" name="body" rows="10" data-processed="0" data-config='... "extraPlugins": "blockquote", ...' data-external-plugin-resources='[]'

但是插件没有加载。我用火狐网络调试器检查了一下。这些文件被加载ckeditor-init.jsckeditor.jsconfig.js', but not a single file of块引用'。

相关问题:https://github.com/django-ckeditor/django-ckeditor/issues/261

如何在CKEditor中加载块引用插件?

更新在另一个问题中,作者看到了对"代码片段/插件.js"的请求。就我而言,我没有看到对插件.js块引用文件的任何访问权限。

我使用django_ckeditor和块引用,但不需要将其添加为额外的插件。你确定你真的需要这样做吗?我想的一件事是问题在于您定义了额外的插件,但您没有将其放在任何工具栏中。如果未在工具栏中定义,则可能无法加载。您是否尝试过更新工具栏?

这是我的示例配置:

CKEDITOR_CONFIGS = {
    'default': {
        'toolbar_Basic': [
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
            ['Undo', 'Redo'],
            ['Scayt'],
            ['Link', 'Unlink', 'Anchor'],
            ['Source'],
            ['Maximize'],
            ['Bold', 'Italic', 'Underline', 'RemoveFormat'],
            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'],
        ],
        'toolbar': 'Basic',
    },
}

我不使用 Django,所以如果这偏离了基础,我深表歉意。

使用 ckeditor 作为 ckeditor 的子文件夹的文件夹结构设置是否正确?

还是应该是myapp/static/ckeditor/plugins/blockquote?