使用kindeditor中圖片上傳后插入不顯示絕對路徑的修改辦法


鼓搗好了登陸,進入頁面,現在鼓搗日志編輯界面的功能。


找到kindeditor插件kindeditor-all.js有的或者是kindeditor.js,找到urltype的設置,

K.options = {
    designMode : true,
    fullscreenMode : false,
    filterMode : true,
    wellFormatMode : true,
    shadowMode : true,
    loadStyleMode : true,
    basePath : K.basePath,
    themesPath : K.basePath + 'themes/',
    langPath : K.basePath + 'lang/',
    pluginsPath : K.basePath + 'plugins/',
    themeType : 'default',
    langType : 'zh-CN',
    urlType : 'absolute',
    newlineTag : 'p',

默認為空,可以改為absolute。然后全局搜索absolute,找到下面一行代碼:

 if (mode === 'relative') {
        url = getRelativePath(host + pathname, 0).substr(2);
    } else if (mode === 'absolute') {
        // if (url.substr(0, host.length) === host) {
        //  url = url.substr(host.length);
        // }
    }
    return url;
if (url.substr(0, host.length) === host) {
      url = url.substr(host.length);
 }這行代碼會把上傳的文件路徑前面的域名端口都剪掉了,所以我們嘗試將他們注釋或者刪除。就會拿到絕對路徑。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM