From b6c82776d9c0600c5734c00ba17d69a451938672 Mon Sep 17 00:00:00 2001 From: Kunal Vashist Date: Tue, 9 Mar 2021 13:35:32 +0530 Subject: [PATCH 1/3] Forked as per needs --- src/lib/index.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/index.jsx b/src/lib/index.jsx index 67777c2..d3e5916 100644 --- a/src/lib/index.jsx +++ b/src/lib/index.jsx @@ -71,15 +71,21 @@ const getUntouchedRow = (value) => { }; -const Diff = ({ inputA, inputB, type, options }) => { +const Diff = ({ inputA, inputB, type, highlight, options }) => { index = 0; const diff = fnMap[type](inputA, inputB, options); - const result = diff.map((part) => { + const result = diff.map((part, index) => { + if(highlight){ + var className = part.added ? 'lightgreen' : part.removed ? 'salmon' : 'lightgrey'; + return React.createElement('span', { key: index, className: className }, part.value); + } + else{ return part.added ? getAddedRow(part.value) : part.removed ? getRemovedRow(part.value) : getUntouchedRow(part.value); + } }); return (
@@ -91,7 +97,8 @@ const Diff = ({ inputA, inputB, type, options }) => {
 Diff.defaultProps = {
     inputA: '',
     inputB: '',
-    type: 'chars'
+    type: 'chars',
+    highlight: true
 };
 
 Diff.types = types;

From fec0de6ccfafdc3ae24d3b2cd0052cd1fd6e5ae2 Mon Sep 17 00:00:00 2001
From: Kunal Vashist 
Date: Wed, 10 Mar 2021 12:24:06 +0530
Subject: [PATCH 2/3] Package.json

---
 package.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index a86fe80..0c4f8f1 100644
--- a/package.json
+++ b/package.json
@@ -34,11 +34,11 @@
     "webpack-cli": "^3.1.2",
     "webpack-dev-server": "^3.1.3"
   },
-  "author": "Lefortov",
-  "homepage": "https://github.com/Lefortov/react-diff",
+  "author": "Kunal",
+  "homepage": "https://github.com/kunalvashist/react-diff.git",
   "repository": {
     "type": "git",
-    "url": "git@github.com:Lefortov/react-diff.git"
+    "url": "git@github.com:kunalvashist/react-diff.git"
   },
   "dependencies": {
     "diff": "^3.5.0"

From a13825e02f0947ce25a390c26c728d3d9a50b049 Mon Sep 17 00:00:00 2001
From: kunalvashist 
Date: Wed, 10 Mar 2021 12:52:46 +0530
Subject: [PATCH 3/3] Update README.md

---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 84ee4f5..8598451 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # react-diff-component
 
-Highlights differences between two strings, uses the [diff](https://www.npmjs.com/package/diff) module based on (https://github.com/cezary/react-diff)
+Highlights differences between two strings, uses the [diff](https://www.npmjs.com/package/diff) module based on (https://github.com/Lefortov/react-diff)
 
 ## Installation
 
@@ -24,4 +24,4 @@ const Component = () => (
 
 ## License
 
-MIT
\ No newline at end of file
+MIT