如何删除 CKeditor 的新图像属性?照片上传,还是浏览器服务器属性?

发布于 2024-09-12 00:32:22 字数 92 浏览 10 评论 0原文

我刚刚升级了我的 ckEditor,它添加了一些我现在不需要的选项。

其中包括浏览文件中的图像,而不仅仅是将它们作为 URL 包含在内。如何删除这些选项?

I just upgraded my ckEditor, and it's added a few options I don't want right now.

Of them are to browse images from files rather than just include them as urls. How do I remove those options?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清醇 2024-09-19 00:32:22

创建编辑器时使用 removeDialogTabs 参数,例如使用 jQuery 插件:

$(selector).ckeditor({
    removeDialogTabs: 'link:target;link:upload;link:advanced;image:Link;image:advanced',
});

Use the removeDialogTabs parameter when you create the editor, for example, using the jQuery plugin:

$(selector).ckeditor({
    removeDialogTabs: 'link:target;link:upload;link:advanced;image:Link;image:advanced',
});
烟柳画桥 2024-09-19 00:32:22

在源 HTML/JS 文件中,您将有一些用 CKEditor 替换 textarea 的代码。它的内容如下:

CKEDITOR.replace( 'editor1',
{
    … /* parameters */
    filebrowserUploadUrl : '/uploader/upload.php',
    … /* other parameters */
});

如果删除 filebrowserUploadUrl 参数(或清空分配给它的字符串),则图像上传选项卡将消失。

请注意,除了或代替 filebrowserUploadUrl,您还可以有一个名为 filebrowserImageUploadUrl 的参数。在这种情况下,您还必须删除或清空此参数。

有关更多详细信息,请参阅文件浏览器(上传器)

其他解决方案

您还可以自定义每个对话框

通过监听dialogDefinition
CKEditor 的事件可以
自定义对话框删除选项卡
更改默认值。

因此,如果您想以这种方式删除上传选项卡,只需添加以下代码:

CKEDITOR.on( 'dialogDefinition', function( ev ) {
    // Take the dialog name and its definition from the event data
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    if ( dialogName == 'image' ) {
        // Remove upload tab
        dialogDefinition.removeContents('Upload');
    }
});

In your source HTML/JS file you'll have some code that replaces a textarea with the CKEditor. It reads something like:

CKEDITOR.replace( 'editor1',
{
    … /* parameters */
    filebrowserUploadUrl : '/uploader/upload.php',
    … /* other parameters */
});

If you delete the filebrowserUploadUrl parameter (or empty the string assigned to it), the image upload tab will be gone.

Note that, apart from or instead of filebrowserUploadUrl, you can also have a parameter called filebrowserImageUploadUrl. In that case, you have to delete or empty this parameter as well.

See File Browser (Uploader) for more details.

Other solution

You can also customize every dialog:

By listening to the dialogDefinition
event of CKEditor it's possible to
customize the dialogs removing tabs or
changing the default values.

So, if you want to remove the upload tab this way, just add the following code:

CKEDITOR.on( 'dialogDefinition', function( ev ) {
    // Take the dialog name and its definition from the event data
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    if ( dialogName == 'image' ) {
        // Remove upload tab
        dialogDefinition.removeContents('Upload');
    }
});
无人问我粥可暖 2024-09-19 00:32:22

只需将其添加到您的 config.js 中即可。好摆脱。

CKEDITOR.on( 'dialogDefinition', function( ev ) {
   var dialogName = ev.data.name;
   var dialogDefinition = ev.data.definition;
   if ( dialogName == 'image' ) {
         dialogDefinition.removeContents( 'Link' );
         dialogDefinition.removeContents( 'advanced' );
         dialogDefinition.removeContents( 'Upload' );
   }
});

Just add this to your config.js . Good riddance.

CKEDITOR.on( 'dialogDefinition', function( ev ) {
   var dialogName = ev.data.name;
   var dialogDefinition = ev.data.definition;
   if ( dialogName == 'image' ) {
         dialogDefinition.removeContents( 'Link' );
         dialogDefinition.removeContents( 'advanced' );
         dialogDefinition.removeContents( 'Upload' );
   }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文