鼓搗好了登陸,進入頁面,現在鼓搗日志編輯界面的功能。
找到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);
}這行代碼會把上傳的文件路徑前面的域名端口都剪掉了,所以我們嘗試將他們注釋或者刪除。就會拿到絕對路徑。