react-diff-viewer-continued 4.0.5 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [4.0.6](https://github.com/aeolun/react-diff-viewer-continued/compare/v4.0.5...v4.0.6) (2025-05-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * allow non-string rendered contents ([a0ab52d](https://github.com/aeolun/react-diff-viewer-continued/commit/a0ab52d3d064297d1957c7fb65f9742f53a191a7))
7
+ * fixup [#68](https://github.com/aeolun/react-diff-viewer-continued/issues/68) for non-string wordDiff.value ([3678e02](https://github.com/aeolun/react-diff-viewer-continued/commit/3678e020855f0fec8f15084291cb5adc54a2c009))
8
+
1
9
  ## [4.0.5](https://github.com/aeolun/react-diff-viewer-continued/compare/v4.0.4...v4.0.5) (2025-01-31)
2
10
 
3
11
 
@@ -108,9 +108,10 @@ class DiffViewer extends React.Component {
108
108
  return diffArray.map((wordDiff, i) => {
109
109
  const content = renderer
110
110
  ? renderer(wordDiff.value)
111
- : wordDiff.value;
112
- if (typeof content !== "string")
113
- return;
111
+ : (typeof wordDiff.value === 'string'
112
+ ? wordDiff.value
113
+ // If wordDiff.value is DiffInformation, we don't handle it, unclear why. See c0c99f5712.
114
+ : undefined);
114
115
  return wordDiff.type === compute_lines_js_1.DiffType.ADDED ? ((0, jsx_runtime_1.jsx)("ins", { className: (0, classnames_1.default)(this.styles.wordDiff, {
115
116
  [this.styles.wordAdded]: wordDiff.type === compute_lines_js_1.DiffType.ADDED,
116
117
  }), children: content }, i)) : wordDiff.type === compute_lines_js_1.DiffType.REMOVED ? ((0, jsx_runtime_1.jsx)("del", { className: (0, classnames_1.default)(this.styles.wordDiff, {
@@ -89,9 +89,10 @@ class DiffViewer extends React.Component {
89
89
  return diffArray.map((wordDiff, i) => {
90
90
  const content = renderer
91
91
  ? renderer(wordDiff.value)
92
- : wordDiff.value;
93
- if (typeof content !== "string")
94
- return;
92
+ : (typeof wordDiff.value === 'string'
93
+ ? wordDiff.value
94
+ // If wordDiff.value is DiffInformation, we don't handle it, unclear why. See c0c99f5712.
95
+ : undefined);
95
96
  return wordDiff.type === DiffType.ADDED ? (_jsx("ins", { className: cn(this.styles.wordDiff, {
96
97
  [this.styles.wordAdded]: wordDiff.type === DiffType.ADDED,
97
98
  }), children: content }, i)) : wordDiff.type === DiffType.REMOVED ? (_jsx("del", { className: cn(this.styles.wordDiff, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-diff-viewer-continued",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "private": false,
5
5
  "description": "Continuation of a simple and beautiful text diff viewer component made with diff and React",
6
6
  "keywords": [