您的位置:首页 > 产品设计 > UI/UE

百度ueditor组件上传图片后<img>里的alt设置

2014-08-27 10:12 519 查看
baiduueditor组件上载图像后里的alt设置,有需求的朋友能够参阅下。

baiduueditor组件,运用上载图像后,自动将上载图像显现在修正器中,也即是插入了一个标签。并设置了一个alt特点,其值是上载图像时的本地途径。暂时没发现哪里能够配置这个值。在检查发布的内容时,看到alt的值是一个磁盘途径,有点别扭。

能够在修正完内容,保存到数据库时过滤下,修正alt的内容,也能够直接修正源码

function callback(石家庄绿植租赁){
try{
var link, json, loader,
body = (iframe.contentDocument || iframe.contentWindow.document).body,
result = body.innerText || body.textContent || '';
json = (new Function("return " + result))();
link = me.options.imageUrlPrefix + json.url;
if(json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', json.title || '');
loader.setAttribute('alt', json.original || '');
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(json.state);
}
}catch(er){
showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));
}
form.reset();
domUtils.un(iframe, 'load', callback);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: