mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Improve diff count for diff-text widget
This commit is contained in:
parent
47cdf55133
commit
0080728d36
@ -57,7 +57,12 @@ DiffTextWidget.prototype.render = function(parent,nextSibling) {
|
||||
domDiff = this.createDiffDom(diffs);
|
||||
parent.insertBefore(domContainer,nextSibling);
|
||||
// Set variables
|
||||
this.setVariable("diff-count",Math.trunc((diffs.length - 1) / 2).toString());
|
||||
this.setVariable("diff-count",diffs.reduce(function(acc,diff) {
|
||||
if(diff[0] !== dmp.DIFF_EQUAL) {
|
||||
acc++;
|
||||
}
|
||||
return acc;
|
||||
},0).toString());
|
||||
// Render child widgets
|
||||
this.renderChildren(domContainer,null);
|
||||
// Render the diff
|
||||
|
Loading…
Reference in New Issue
Block a user