diff --git a/build/MDEditor.min.js b/build/MDEditor.min.js index 859898b..cb7562d 100644 --- a/build/MDEditor.min.js +++ b/build/MDEditor.min.js @@ -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; @@ -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; diff --git a/lib/MDEditor.js b/lib/MDEditor.js index a2c1ecd..4777d1a 100644 --- a/lib/MDEditor.js +++ b/lib/MDEditor.js @@ -179,7 +179,9 @@ }); } css(self.preview,{'height':self.textarea.offsetHeight + "px"}); + self.callback(event,self.opts) }); + return this; } /** * [getMD 获取markdown的字符串] @@ -206,6 +208,11 @@ else return this.preview.innerHTML } + MDEditor.prototype.input = function(evn){ + this.callback = evn + return this; + } + /** * [setHTML 设置预览的HTML] */