From e571690731ad053ccdf22d4e513d4cbbb44753b4 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sun, 5 Jul 2015 18:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E5=BA=A6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/MDEditor.min.js | 2 +- lib/MDEditor.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build/MDEditor.min.js b/build/MDEditor.min.js index 424d931..95d4a3e 100644 --- a/build/MDEditor.min.js +++ b/build/MDEditor.min.js @@ -938,7 +938,7 @@ }; MDEditor.prototype.setMD = function(val) { if (marked) this.textarea.value = val ? val : this.opts.value; - if (this.textarea.scrollHeight < this.opts.maxheight) this.textarea.style.height = this.textarea.scrollHeight + "px"; else if (this.textarea.scrollHeight > this.opts.maxheight) this.textarea.style.height = this.opts.maxheight + "px"; + this.textarea.style.height = (this.textarea.scrollHeight < this.opts.maxheight ? this.textarea.scrollHeight : this.opts.maxheight) + "px"; return this; }; MDEditor.prototype.getHTML = function() { diff --git a/lib/MDEditor.js b/lib/MDEditor.js index 4a6cb01..886690c 100644 --- a/lib/MDEditor.js +++ b/lib/MDEditor.js @@ -202,10 +202,7 @@ */ MDEditor.prototype.setMD =function(val){ if(marked) this.textarea.value = val?val:this.opts.value; - if(this.textarea.scrollHeightthis.opts.maxheight) - this.textarea.style.height = this.opts.maxheight + 'px'; + this.textarea.style.height = (this.textarea.scrollHeight