@git-diff-view/react 0.0.29 → 0.0.30
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/dist/cjs/index.development.js +4 -2
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +4 -2
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/esm/index.mjs +4 -2
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +2 -2
- package/readme.md +3 -3
- package/src/components/DiffView.tsx +3 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "@git-diff-view/react",
|
|
4
4
|
"author": "MrWangJustToDo",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.30",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react diff component"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@git-diff-view/core": "^0.0.
|
|
64
|
+
"@git-diff-view/core": "^0.0.30",
|
|
65
65
|
"@types/hast": "^3.0.0",
|
|
66
66
|
"fast-diff": "^1.3.0",
|
|
67
67
|
"highlight.js": "^11.11.0",
|
package/readme.md
CHANGED
|
@@ -95,9 +95,9 @@ const diffFile = DiffFile.createInstance(data || {}, bundle);
|
|
|
95
95
|
| extendData | a list to store the extend data to show in the `Diff View`, type: {oldFile: {lineNumber: {data: any}}, newFile: {lineNumber: {data: any}}} |
|
|
96
96
|
| diffViewFontSize | the fontSize for the DiffView component, type: number |
|
|
97
97
|
| diffViewHighlight | enable syntax highlight, type: boolean |
|
|
98
|
-
| diffViewMode | the mode for the DiffView component, type: `DiffModeEnum.Split`
|
|
98
|
+
| diffViewMode | the mode for the DiffView component, type: `DiffModeEnum.Split` / `DiffModeEnum.Unified` |
|
|
99
99
|
| diffViewWrap | enable code line auto wrap, type: boolean |
|
|
100
|
-
| diffViewTheme | the theme for the DiffView component, type: `light`
|
|
100
|
+
| diffViewTheme | the theme for the DiffView component, type: `light` / `dark` |
|
|
101
101
|
| diffViewAddWidget| enable `addWidget` button, type: boolean |
|
|
102
|
-
| onAddWidgetClick | when the `addWidget` button clicked, type: `({ side: "old"
|
|
102
|
+
| onAddWidgetClick | when the `addWidget` button clicked, type: `({ side: "old" / "new", lineNumber: number }) => void` |
|
|
103
103
|
|
|
@@ -306,6 +306,7 @@ const DiffViewWithRef = <T extends unknown>(
|
|
|
306
306
|
|
|
307
307
|
useEffect(() => {
|
|
308
308
|
if (!diffFile) return;
|
|
309
|
+
|
|
309
310
|
if (props.diffViewHighlight) {
|
|
310
311
|
diffFile.initSyntax({ registerHighlighter });
|
|
311
312
|
diffFile.notifyAll();
|
|
@@ -313,6 +314,8 @@ const DiffViewWithRef = <T extends unknown>(
|
|
|
313
314
|
}, [diffFile, props.diffViewHighlight, registerHighlighter]);
|
|
314
315
|
|
|
315
316
|
useEffect(() => {
|
|
317
|
+
if (!diffFile) return;
|
|
318
|
+
|
|
316
319
|
const init = () => {
|
|
317
320
|
wrapperRef.current?.setAttribute("data-theme", diffFile._getTheme() || "light");
|
|
318
321
|
wrapperRef.current?.setAttribute("data-highlighter", diffFile._getHighlighterName());
|