kindeditor图片上传改为一次弹框
This commit is contained in:
parent
f7dd4924c1
commit
681f7b75d6
|
@ -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,7 +5553,39 @@ _plugin('core', function(K) {
|
|||
self.clickToolbar('fullscreen', function() {
|
||||
self.fullscreen();
|
||||
});
|
||||
if (self.fullscreenShortcut) {
|
||||
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() {
|
||||
K(self.edit.doc, self.edit.textarea).keyup(function(e) {
|
||||
|
@ -5585,6 +5618,10 @@ _plugin('core', function(K) {
|
|||
self[name]();
|
||||
});
|
||||
});
|
||||
self.clickToolbar('imagedirectupload', function() {
|
||||
$('.ke-upload-file').focus().trigger('click');
|
||||
|
||||
});
|
||||
self.clickToolbar('formatblock', function() {
|
||||
var blocks = self.lang('formatblock.formatBlock'),
|
||||
heights = {
|
||||
|
|
Loading…
Reference in New Issue