UEditor编辑器如何关闭抓取远程图片本地化功能

场景:直接copy图片至ueditor的时候,编辑器会默认将图片本地化并返回本地化的src

问题:日积月累本地化copy的图片对服务器压力很大

需求:去掉copy图片本地化

解决办法:

1、打开ueditor.all.js

   搜索“抓取”的时候出现以下代码:

// plugins/catchremoteimage.js
///import core
///commands 远程图片抓取
///commandsName  catchRemoteImage,catchremoteimageenable
///commandsTitle  远程图片抓取
/**
 * 远程图片抓取,当开启本插件时所有不符合本地域名的图片都将被抓取成为本地服务器上的图片
 */
UE.plugins['catchremoteimage'] = function () {
    var me = this,
        ajax = UE.ajax;
    /* 设置默认值 */
    if (me.options.catchRemoteImageEnable === false) return;
    me.setOpt({
        catchRemoteImageEnable: false
    });
    //.......
};

发现:catchRemoteImageEnable

2、打开ueditor.config.js

    在空白处添加

//抓取远程图片是否开启,默认true
,catchRemoteImageEnable:false


© 版权声明
THE END