vendor/assets/javascripts/codemirror/addons/merge/merge.js in codemirror-rails-3.20 vs vendor/assets/javascripts/codemirror/addons/merge/merge.js in codemirror-rails-3.21
- old
+ new
@@ -27,11 +27,11 @@
constructor: DiffView,
init: function(pane, orig, options) {
this.edit = this.mv.edit;
this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: true}, copyObj(options)));
- this.diff = getDiff(orig, options.value);
+ this.diff = getDiff(asString(orig), asString(options.value));
this.diffOutOfDate = false;
this.showDifferences = options.showDifferences !== false;
this.forceUpdate = registerUpdate(this);
setScrollLock(this, true, false);
@@ -349,9 +349,14 @@
setShowDifferences: function(val) {
if (this.right) this.right.setShowDifferences(val);
if (this.left) this.left.setShowDifferences(val);
}
};
+
+ function asString(obj) {
+ if (typeof obj == "string") return obj;
+ else return obj.getValue();
+ }
// Operations on diffs
var dmp = new diff_match_patch();
function getDiff(a, b) {