kindeditor图片上传改为一次弹框

This commit is contained in:
lizanle 2015-04-23 18:07:51 +08:00
parent f7dd4924c1
commit 681f7b75d6
1 changed files with 38 additions and 1 deletions

View File

@ -3523,6 +3523,7 @@ var html, _direction = '';
if ((html = document.getElementsByTagName('html'))) {
_direction = html[0].dir;
}
function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
var arr = [
(_direction === '' ? '<html>' : '<html dir="' + _direction + '">'),
@ -5552,6 +5553,38 @@ _plugin('core', function(K) {
self.clickToolbar('fullscreen', function() {
self.fullscreen();
});
inputObj = document.createElement("input");
inputObj.setAttribute('id', 'jUploadFile_ef');
inputObj.setAttribute('type', 'button');
inputObj.setAttribute('style', 'visibility:hidden');
document.body.appendChild(inputObj);
window.uploadButton = K.uploadbutton({
button: inputObj,
fieldName:'imgFile',
url:K.addParam('/kindeditor/upload', 'dir=image'),
afterUpload : function(data) {
if (data.error === 0) {
var url = K.formatUrl(data.url, 'absolute');
self.exec('insertimage', url, 'image','','','1','left');
var asset_id = data.asset_id;
if ( asset_id != "" && parent.document.getElementById('asset_id') != null ) {
parent.document.getElementById('asset_id').value += asset_id.toString();
parent.document.getElementById('asset_id').value += ",";
}else{
//TODO 暂时什么也不做
}
} else {
alert(data.message);
}
},
afterError : function(str) {
alert('error: ' + str);
}
});
uploadButton.fileBox.change(function(e) {
uploadButton.submit();
});
if (self.fullscreenShortcut) {
var loaded = false;
self.afterCreate(function() {
@ -5584,6 +5617,10 @@ _plugin('core', function(K) {
self.clickToolbar(name, function() {
self[name]();
});
});
self.clickToolbar('imagedirectupload', function() {
$('.ke-upload-file').focus().trigger('click');
});
self.clickToolbar('formatblock', function() {
var blocks = self.lang('formatblock.formatBlock'),