Skip to content

Commit

Permalink
高度优化
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 5, 2015
1 parent 5b54813 commit e571690
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/MDEditor.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 1 addition & 4 deletions lib/MDEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,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;
}

Expand Down

0 comments on commit e571690

Please sign in to comment.