kindeditor默认上传图是不带域名域名绝对路径了,如果我们希望生成之后带上域名就需要进入urlType进行设置了,我们kindeditor中的urlType有几个参数默认这空值”“、”relative”、”absolute”、”domain”了。
关键在于初始化kindeditor时指定以下参数:
urlType
”“ 空为不修改URL
”relative” 相对路径
”absolute” 绝对路径
”domain” 带域名的绝对路径。
例子:
代码如下:
htmlEditor = K.create(
'#content',
{
uploadJson : '../kindeditor/jsp/upload_json.jsp',
fileManagerJson : '../kindeditor/jsp/file_manager_json.jsp',
height : 300,
width : '90%',
// fontSizeTable:['21px','20px','17px','18px','16px','14px','12px'],
resizeType : 0,//1
allowPreviewEmoticons : true,
allowImageUpload : true,
urlType:'domain'
});
后面在另一个网站看到另一个方法
<script>
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="content"]', {
cssPath : '/assets/kindeditor/plugins/code/prettify.css',
uploadJson : '/assets/kindeditor/php/upload_json.php',
fileManagerJson : '/assets/kindeditor/php/file_manager_json.php',
urlType:'domain',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=andNews]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=andNews]')[0].submit();
});
}
});
prettyPrint();
});
</script>