From c382afa2a512b5018711141d5f0f76bcc2bf47ec Mon Sep 17 00:00:00 2001 From: Jamie Peabody Date: Sun, 3 Mar 2013 22:45:56 +0000 Subject: [PATCH] Fixed setting lhs/rhs using CodeMirror's setValue. --- lib/mergely.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mergely.js b/lib/mergely.js index 64f58e8..b611cdb 100644 --- a/lib/mergely.js +++ b/lib/mergely.js @@ -599,8 +599,14 @@ jQuery.extend(Mgly.mergely.prototype, { } jQuery('').appendTo('head'); this.bind(); - if (this.settings.lhs) this.settings.lhs( this.editor[this.id + '-lhs'].setValue ); - if (this.settings.rhs) this.settings.rhs( this.editor[this.id + '-rhs'].setValue ); + if (this.settings.lhs) { + var setv = this.editor[this.id + '-lhs'].getDoc().setValue; + this.settings.lhs(setv.bind(this.editor[this.id + '-lhs'].getDoc())); + } + if (this.settings.rhs) { + var setv = this.editor[this.id + '-rhs'].getDoc().setValue; + this.settings.rhs(setv.bind(this.editor[this.id + '-rhs'].getDoc())); + } // resize only after bind this.settings.resize();