- @for (lineDiff of calculatedDiff; track lineDiff) {
+ @for (lineDiff of calculatedDiff; track lineDiff.id) {
{
+ ({ id, type, lineNumberInOldText, lineNumberInNewText, line, args }) => {
return {
+ id,
type,
lineNumberInOldText,
lineNumberInNewText,
@@ -272,6 +276,7 @@ export class UnifiedDiffComponent implements OnInit, OnChanges {
// Output a special line indicating that some content is equal and has been skipped
diffCalculation.lines.push({
+ id: `skip-${diffCalculation.lineInOldText}-${diffCalculation.lineInNewText}-${skippedLines.length}`,
type: LineDiffType.Placeholder,
lineNumberInOldText: null,
lineNumberInNewText: null,
@@ -302,6 +307,7 @@ export class UnifiedDiffComponent implements OnInit, OnChanges {
private outputEqualDiffLines(diffLines: string[], diffCalculation: IDiffCalculation): void {
for (const line of diffLines) {
diffCalculation.lines.push({
+ id: `eql-${diffCalculation.lineInOldText}-${diffCalculation.lineInNewText}`,
type: LineDiffType.Equal,
lineNumberInOldText: diffCalculation.lineInOldText,
lineNumberInNewText: diffCalculation.lineInNewText,
@@ -315,6 +321,7 @@ export class UnifiedDiffComponent implements OnInit, OnChanges {
private outputDeleteDiff(diffLines: string[], diffCalculation: IDiffCalculation): void {
for (const line of diffLines) {
diffCalculation.lines.push({
+ id: `del-${diffCalculation.lineInOldText}`,
type: LineDiffType.Delete,
lineNumberInOldText: diffCalculation.lineInOldText,
lineNumberInNewText: null,
@@ -327,6 +334,7 @@ export class UnifiedDiffComponent implements OnInit, OnChanges {
private outputInsertDiff(diffLines: string[], diffCalculation: IDiffCalculation): void {
for (const line of diffLines) {
diffCalculation.lines.push({
+ id: `ins-${diffCalculation.lineInNewText}`,
type: LineDiffType.Insert,
lineNumberInOldText: null,
lineNumberInNewText: diffCalculation.lineInNewText,
From 179e0fed54ef917a286434ae68d04890790b1a6f Mon Sep 17 00:00:00 2001
From: Richard Russell <2265225+rars@users.noreply.github.com>
Date: Wed, 9 Oct 2024 11:56:07 +0100
Subject: [PATCH 2/2] docs: update changelog for 9.1.0 release
---
CHANGELOG.md | 7 +++++++
package-lock.json | 4 ++--
package.json | 2 +-
projects/ngx-diff/package.json | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b27c842..b867134 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+## [9.1.0](https://github.com/rars/ngx-diff/compare/v9.0.0...v9.1.0) (2024-10-09)
+
+
+### Features
+
+* **ngx-diff:** improve tracking on line diff DOM elements ([ffe25bd](https://github.com/rars/ngx-diff/commit/ffe25bd73079db06695265ef03b2ee2200de5e5e))
+
## [9.0.0](https://github.com/rars/ngx-diff/compare/v8.0.4...v9.0.0) (2024-06-06)
diff --git a/package-lock.json b/package-lock.json
index 8d039c6..79e09cb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "ngx-diff",
- "version": "9.0.0",
+ "version": "9.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ngx-diff",
- "version": "9.0.0",
+ "version": "9.1.0",
"dependencies": {
"@angular/animations": "^18.0.2",
"@angular/common": "^18.0.2",
diff --git a/package.json b/package.json
index 734a845..6e46fec 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ngx-diff",
- "version": "9.0.0",
+ "version": "9.1.0",
"type": "module",
"scripts": {
"ng": "ng",
diff --git a/projects/ngx-diff/package.json b/projects/ngx-diff/package.json
index a8d8aac..82b0fea 100644
--- a/projects/ngx-diff/package.json
+++ b/projects/ngx-diff/package.json
@@ -1,6 +1,6 @@
{
"name": "ngx-diff",
- "version": "9.0.0",
+ "version": "9.1.0",
"peerDependencies": {
"@angular/common": ">=18.0.0",
"@angular/core": ">=18.0.0",