From 63785564e8df5bcaca36c35e3d330d94d2b75d78 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 9 Jun 2015 16:06:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8D=E6=94=AF=E6=8C=81=E5=A4=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 176e00ec8..d9b51648c 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; + 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,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() { From 4ed4d3fa44169a3a45199105b5fdfea470351ce6 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 9 Jun 2015 16:21:19 +0800 Subject: [PATCH 2/3] ... --- public/assets/kindeditor/kindeditor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index d9b51648c..b019bccf1 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -4188,7 +4188,7 @@ _extend(KUploadButton, { button.hide(); button.before(div); self.div = div; - options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数 + 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); @@ -4990,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 == '|') { From 918d03d4ddda6602f018e5d6853ff2fbf2d90ce5 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 10 Jun 2015 10:29:17 +0800 Subject: [PATCH 3/3] ... --- app/views/boards/show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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'});