diff --git a/README.md b/README.md index 72b1252..d50fb30 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ class MyComponent extends Component { You can also specify different values in `props.type` to compare in different ways. Valid values are `'chars'`, -`'words'`, `'sentences'` and `'json'`: +`'words'`, `'sentences'`, `'json'` and `'lines'`: ```javascript diff --git a/dist/react-diff.js b/dist/react-diff.js index da33c46..a8b2cf7 100644 --- a/dist/react-diff.js +++ b/dist/react-diff.js @@ -6,14 +6,15 @@ const fnMap = { 'chars': jsdiff.diffChars, 'words': jsdiff.diffWords, 'sentences': jsdiff.diffSentences, - 'json': jsdiff.diffJson + 'json': jsdiff.diffJson, + 'lines': (oldStr, newStr) => jsdiff.diffLines(oldStr, newStr, { newlineIsToken: true }) }; /** * Display diff in a stylable form. * * Default is character diff. Change with props.type. Valid values - * are 'chars', 'words', 'sentences', 'json'. + * are 'chars', 'words', 'sentences', 'json', 'lines,. * * - Wrapping div has class 'Difference', override with props.className * - added parts are in diff --git a/lib/react-diff.js b/lib/react-diff.js index 56557ed..1cd8547 100644 --- a/lib/react-diff.js +++ b/lib/react-diff.js @@ -6,14 +6,15 @@ const fnMap = { 'chars': jsdiff.diffChars, 'words': jsdiff.diffWords, 'sentences': jsdiff.diffSentences, - 'json': jsdiff.diffJson + 'json': jsdiff.diffJson, + 'lines': (oldStr, newStr) => jsdiff.diffLines(oldStr, newStr, {newlineIsToken: true}) }; /** * Display diff in a stylable form. * * Default is character diff. Change with props.type. Valid values - * are 'chars', 'words', 'sentences', 'json'. + * are 'chars', 'words', 'sentences', 'json', 'lines,. * * - Wrapping div has class 'Difference', override with props.className * - added parts are in