File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ var AngularRichTextDiff;
1616 _this . doDiff ( ) ;
1717 } ) ;
1818 this . tagMap = { } ;
19+ this . mapLength = 0 ;
1920 this . dmp = new diff_match_patch ( ) ;
2021 this . doDiff ( ) ;
2122 }
@@ -92,9 +93,10 @@ var AngularRichTextDiff;
9293 var unicodeCharacter = this . tagMap [ tagString ] ;
9394 if ( unicodeCharacter === undefined ) {
9495 // Nope, need to map it
95- unicodeCharacter = String . fromCharCode ( this . unicodeRangeStart + this . tagMap . length ) ;
96+ unicodeCharacter = String . fromCharCode ( this . unicodeRangeStart + this . mapLength ) ;
9697 this . tagMap [ tagString ] = unicodeCharacter ;
9798 this . tagMap [ unicodeCharacter ] = tagString ;
99+ this . mapLength ++ ;
98100 }
99101 // At this point it has been mapped, so now we can use it
100102 diffableString += htmlString . substr ( offset , tagStart - offset ) ;
Original file line number Diff line number Diff line change @@ -21,12 +21,14 @@ module AngularRichTextDiff {
2121
2222 unicodeRangeStart = 0xE000 ;
2323 tagMap : any ;
24+ mapLength : number ;
2425 dmp : diff_match_patch ;
2526
2627 constructor ( public $scope : IRichTextDiffScope , public $sce : ng . ISCEService ) {
2728 $scope . $watch ( 'left' , ( ) => { this . doDiff ( ) ; } ) ;
2829 $scope . $watch ( 'right' , ( ) => { this . doDiff ( ) ; } ) ;
2930 this . tagMap = { } ;
31+ this . mapLength = 0 ;
3032 this . dmp = new diff_match_patch ( ) ;
3133 this . doDiff ( ) ;
3234 }
@@ -110,9 +112,10 @@ module AngularRichTextDiff {
110112 var unicodeCharacter = this . tagMap [ tagString ] ;
111113 if ( unicodeCharacter === undefined ) {
112114 // Nope, need to map it
113- unicodeCharacter = String . fromCharCode ( this . unicodeRangeStart + this . tagMap . length ) ;
115+ unicodeCharacter = String . fromCharCode ( this . unicodeRangeStart + this . mapLength ) ;
114116 this . tagMap [ tagString ] = unicodeCharacter ;
115117 this . tagMap [ unicodeCharacter ] = tagString ;
118+ this . mapLength ++ ;
116119 }
117120
118121 // At this point it has been mapped, so now we can use it
You can’t perform that action at this time.
0 commit comments