This commit is contained in:
sw 2015-06-10 10:32:51 +08:00
commit e1636d20d0
2 changed files with 22 additions and 9 deletions

View File

@ -104,7 +104,8 @@ function nh_check_field(params){
result=false; result=false;
} }
if(params.content.html()!=params.textarea.html() || params.issubmit==true){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html()); // params.textarea.html(params.content.html()); //用这个ie11提交到服务器居然木有值 真特么旧梦已尘风
params.content.sync(); //但是这个貌似编辑器没内容时不会同步到textarea中 新愁不言中...
if(params.content.isEmpty()){ if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空'); params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'}); params.contentmsg.css({color:'#ff0000'});

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 * KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2013 kindsoft.net * Copyright (C) 2006-2013 kindsoft.net
@ -4150,6 +4157,7 @@ function KUploadButton(options) {
} }
_extend(KUploadButton, { _extend(KUploadButton, {
init : function(options) { init : function(options) {
//dump_obj(options);
var self = this, var self = this,
button = K(options.button), button = K(options.button),
fieldName = options.fieldName || 'file', fieldName = options.fieldName || 'file',
@ -4180,6 +4188,7 @@ _extend(KUploadButton, {
button.hide(); button.hide();
button.before(div); button.before(div);
self.div = div; self.div = div;
if(options.ops!=undefined)options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数
self.button = button; self.button = button;
self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div); self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div);
self.form = options.form ? K(options.form) : K('form', div); self.form = options.form ? K(options.form) : K('form', div);
@ -4981,13 +4990,13 @@ KEditor.prototype = {
'emoticons', 'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|', 'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link', "less", 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media', "less",
'/', '/',
'undo', 'redo', '|', 'preview', 'print', 'template', 'undo', 'redo', '|', 'preview', 'print', 'template',
'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'clearhtml', 'quickformat', 'selectall', 'fontname', 'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/ 'fontname',
'strikethrough', 'lineheight', 'hr', 'pagebreak', 'strikethrough', 'lineheight', 'hr', 'pagebreak',
'anchor' , 'unlink' 'anchor' , 'link','unlink'
] ]
K.each(fullItems, function(i, name) { K.each(fullItems, function(i, name) {
if (name == '|') { if (name == '|') {
@ -5602,7 +5611,10 @@ _plugin('core', function(K) {
inputObj.setAttribute('type', 'button'); inputObj.setAttribute('type', 'button');
inputObj.setAttribute('style', 'visibility:hidden'); inputObj.setAttribute('style', 'visibility:hidden');
document.body.appendChild(inputObj); document.body.appendChild(inputObj);
window.uploadButton = K.uploadbutton({
//window.uploadButton = K.uploadbutton({
self.uploadButton = K.uploadbutton({
ops:self, //self 是KindEditor.create()的options参数
button: inputObj, button: inputObj,
fieldName:'imgFile', fieldName:'imgFile',
url:K.addParam('/kindeditor/upload', 'dir=image'), url:K.addParam('/kindeditor/upload', 'dir=image'),
@ -5625,8 +5637,8 @@ _plugin('core', function(K) {
alert('error: ' + str); alert('error: ' + str);
} }
}); });
uploadButton.fileBox.change(function(e) { self.uploadButton.fileBox.change(function(e) {
uploadButton.submit(); self.uploadButton.submit();
}); });
if (self.fullscreenShortcut) { if (self.fullscreenShortcut) {
@ -5663,7 +5675,7 @@ _plugin('core', function(K) {
}); });
}); });
self.clickToolbar('imagedirectupload', function() { self.clickToolbar('imagedirectupload', function() {
$('.ke-upload-file').focus().trigger('click'); $('.ke-upload-file',this.up_file_div).trigger('click');
}); });
self.clickToolbar('formatblock', function() { self.clickToolbar('formatblock', function() {