【问题标题】:CKEditor4-react : add EasyImage plugin without cloud urlCKEditor4-react : 添加 EasyImage 插件,无需云 url
【发布时间】:2019-08-09 13:33:02
【问题描述】:

我正在使用 CKEditor4-react 并想添加 EasyImage 插件但不使用云服务 URL。作为替代,我在服务器上托管了一个文件夹,它应该上传图像。但它不起作用。

我按照文档使用 EasyImage 插件 - https://ckeditor.com/docs/ckeditor4/latest/examples/easyimage.html https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-cloudServices_uploadUrl

根据它,“cloudServices_uploadUrl”对于 EasyImage 插件是强制性的。

我可以提供一个托管在我们服务器上的备用 URL,以便可以从那里保存和获取图像吗?

CKEditor4 的旧版本用于我们在 Knockout.js 中构建的旧版应用程序之一,它以类似的方式使用 ckeditor/plugin/simpleuploads。

但是我在当前CKEditor4.12版本中没有找到这样的插件

config: {
                toolbar: [
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike'] },
                    { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
                    { name: 'insert', items: ['Link', 'EasyImageUpload', 'Table'] },
                    { name: 'styles', items: ['Styles', 'FontSize', 'Font', 'Format', 'TextColor', 'BGColor'] },
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] }
                ],
                height: 600,
                width: 950,
                extraPlugins: 'easyimage',
                removePlugins: 'image',
                //cloudServices_uploadUrl: 'https://33333.cke-cs.com/easyimage/upload/', //this is a demo ckeditor cloud service URL
                cloudServices_uploadUrl: '/app/Data' //this is folder hosted on our server which is accessible as localhost/app/data
            },

【问题讨论】:

    标签: reactjs ckeditor ckeditor4.x


    【解决方案1】:

    CKEditor 4 的Easy Image plugin 目前只支持云服务上传图片,所以cloudServices_uploadUrl 是强制性的,应该指向CKEditor Cloud Services 端点作为documentation says

    如果您想在自己的服务器上上传和存储图像,您可以使用CKFindercustom upload adapter 或寻找任何满足您需求的第三方解决方案。

    【讨论】:

    • CKFinder 和自定义上传适配器都没有根据文档的反应包装器。有没有其他方法可以使用 CKEditor 以便将图像上传到我们的服务器上?我们的应用程序是在 React 16 中构建的。
    • React 包装器是什么意思?所有 3 个都是通过 CKEditor 4 插件集成的,而 React CKEditor 4 集成是基于编辑器本身的,并且可以与任何插件集一起使用。至于可能的解决方案,您可以使用官方的(Easy Image、CKFinder)、第三方或自己实现。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-05
    • 2019-02-28
    • 2015-02-21
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    • 1970-01-01
    相关资源
    最近更新 更多