百度ueditor組件,使用上傳圖片后,自動將上傳圖片顯示在編輯器中,也就是插入了一個<img>標簽。并設(shè)置了一個alt屬性,其值是上傳圖片時的本地路徑。暫時沒發(fā)現(xiàn)哪里可以配置這個值。在查看發(fā)布的內(nèi)容時,看到alt的值是一個磁盤路徑,有點別扭。
可以在編輯完內(nèi)容,保存到數(shù)據(jù)庫時過濾下,修改alt的內(nèi)容,也可以直接修改源碼
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);}
新聞熱點
疑難解答