Skip to content

Commit

Permalink
add input method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 4, 2015
1 parent 4dfd283 commit a85ca84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/MDEditor.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,9 @@
css(self.preview, {
height: self.textarea.offsetHeight + "px"
});
self.callback(event, self.opts);
});
return this;
};
MDEditor.prototype.getMD = function() {
return this.textarea.value;
Expand All @@ -939,6 +941,10 @@
MDEditor.prototype.getHTML = function() {
if (marked) return marked(this.getMD()); else return this.preview.innerHTML;
};
MDEditor.prototype.input = function(evn) {
this.callback = evn;
return this;
};
MDEditor.prototype.setHTML = function(val) {
if (marked) this.preview.innerHTML = marked(val ? val : this.opts.value);
return this;
Expand Down
7 changes: 7 additions & 0 deletions lib/MDEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@
});
}
css(self.preview,{'height':self.textarea.offsetHeight + "px"});
self.callback(event,self.opts)
});
return this;
}
/**
* [getMD 获取markdown的字符串]
Expand All @@ -206,6 +208,11 @@
else return this.preview.innerHTML
}

MDEditor.prototype.input = function(evn){
this.callback = evn
return this;
}

/**
* [setHTML 设置预览的HTML]
*/
Expand Down

0 comments on commit a85ca84

Please sign in to comment.