解决图片上传不支持多编辑器的bug

This commit is contained in:
yutao 2015-06-09 16:06:26 +08:00
parent 46952212e4
commit 63785564e8
1 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,10 @@
//function dump_obj(myObject) {
// var s = "";
// for (var property in myObject) {
// s = s + "\n "+property +": " + myObject[property] ;
// }
// alert(s);
//}
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2013 kindsoft.net
@ -4150,6 +4157,7 @@ function KUploadButton(options) {
}
_extend(KUploadButton, {
init : function(options) {
//dump_obj(options);
var self = this,
button = K(options.button),
fieldName = options.fieldName || 'file',
@ -4180,6 +4188,7 @@ _extend(KUploadButton, {
button.hide();
button.before(div);
self.div = div;
options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数
self.button = button;
self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div);
self.form = options.form ? K(options.form) : K('form', div);
@ -5602,7 +5611,10 @@ _plugin('core', function(K) {
inputObj.setAttribute('type', 'button');
inputObj.setAttribute('style', 'visibility:hidden');
document.body.appendChild(inputObj);
window.uploadButton = K.uploadbutton({
//window.uploadButton = K.uploadbutton({
self.uploadButton = K.uploadbutton({
ops:self, //self 是KindEditor.create()的options参数
button: inputObj,
fieldName:'imgFile',
url:K.addParam('/kindeditor/upload', 'dir=image'),
@ -5625,8 +5637,8 @@ _plugin('core', function(K) {
alert('error: ' + str);
}
});
uploadButton.fileBox.change(function(e) {
uploadButton.submit();
self.uploadButton.fileBox.change(function(e) {
self.uploadButton.submit();
});
if (self.fullscreenShortcut) {
@ -5663,7 +5675,7 @@ _plugin('core', function(K) {
});
});
self.clickToolbar('imagedirectupload', function() {
$('.ke-upload-file').focus().trigger('click');
$('.ke-upload-file',this.up_file_div).trigger('click');
});
self.clickToolbar('formatblock', function() {