feat(#137): added 'summary' method

This commit is contained in:
Jamie Peabody
2021-04-29 21:20:53 +01:00
parent 5deac86ebc
commit 4610ed3535
7 changed files with 67 additions and 939 deletions

View File

@@ -606,8 +606,22 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
if (side == 'lhs' && !this.lhs_cmsettings.readOnly) le.setValue(re.getValue());
else if (!this.rhs_cmsettings.readOnly) re.setValue(le.getValue());
},
getDiffNumber: function() {
return this.changes.length;
summary: function() {
//console.log('HERE');
return {
numChanges: this.changes.length,
lhsLength: this.editor[this.id + '-lhs'].getValue().length,
rhsLength: this.editor[this.id + '-rhs'].getValue().length,
c: this.changes.filter(function (a) {
return a.op === 'c';
}).length,
a: this.changes.filter(function (a) {
return a.op === 'a';
}).length,
d: this.changes.filter(function (a) {
return a.op === 'd';
}).length
}
},
get: function(side) {
var ed = this.editor[this.id + '-' + side];