diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index bf276925a..2a280fe03 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -104,7 +104,8 @@ function nh_check_field(params){ result=false; } 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()){ params.contentmsg.html('内容不能为空'); params.contentmsg.css({color:'#ff0000'}); diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 176e00ec8..b019bccf1 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -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; + if(options.ops!=undefined)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); @@ -4981,13 +4990,13 @@ KEditor.prototype = { 'emoticons', 'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|', 'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', - 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link', "less", + 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media', "less", '/', 'undo', 'redo', '|', 'preview', 'print', 'template', 'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript', - 'superscript', 'clearhtml', 'quickformat', 'selectall', 'fontname', + 'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/ 'fontname', 'strikethrough', 'lineheight', 'hr', 'pagebreak', - 'anchor' , 'unlink' + 'anchor' , 'link','unlink' ] K.each(fullItems, function(i, name) { if (name == '|') { @@ -5602,8 +5611,11 @@ _plugin('core', function(K) { inputObj.setAttribute('type', 'button'); inputObj.setAttribute('style', 'visibility:hidden'); document.body.appendChild(inputObj); - window.uploadButton = K.uploadbutton({ - button: inputObj, + + //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'), afterUpload : function(data) { @@ -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() {