@git-diff-view/react 0.0.38 → 0.0.40
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 +13 -11
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +13 -11
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/esm/index.mjs +13 -11
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/DiffView.tsx +13 -9
package/index.d.ts
CHANGED
|
@@ -210,6 +210,7 @@ export declare class DiffFile {
|
|
|
210
210
|
_getHighlighterType: () => string;
|
|
211
211
|
_getIsPureDiffRender: () => boolean;
|
|
212
212
|
_getTheme: () => "light" | "dark";
|
|
213
|
+
_getIsCloned: () => boolean;
|
|
213
214
|
_addClonedInstance: (instance: DiffFile) => void;
|
|
214
215
|
_notifyOthers: (instance: DiffFile) => void;
|
|
215
216
|
_delClonedInstance: (instance: DiffFile) => void;
|
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.40",
|
|
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.40",
|
|
65
65
|
"@types/hast": "^3.0.0",
|
|
66
66
|
"fast-diff": "^1.3.0",
|
|
67
67
|
"highlight.js": "^11.11.0",
|
|
@@ -315,17 +315,21 @@ const DiffViewWithRef = <T extends unknown>(
|
|
|
315
315
|
if (!diffFile) return;
|
|
316
316
|
|
|
317
317
|
if (props.diffViewHighlight) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
if (registerHighlighter) {
|
|
319
|
+
if (
|
|
320
|
+
registerHighlighter.name !== diffFile._getHighlighterName() ||
|
|
321
|
+
registerHighlighter.type !== diffFile._getHighlighterType() ||
|
|
322
|
+
registerHighlighter.type !== "class"
|
|
323
|
+
) {
|
|
324
|
+
diffFile.initSyntax({ registerHighlighter: registerHighlighter });
|
|
325
|
+
diffFile.notifyAll();
|
|
326
|
+
}
|
|
327
|
+
} else if (
|
|
328
|
+
(!diffFile._getIsCloned() && diffFile._getHighlighterName() !== buildInHighlighter.name) ||
|
|
329
|
+
diffFile._getHighlighterType() !== "class"
|
|
323
330
|
) {
|
|
324
|
-
diffFile.initSyntax(
|
|
331
|
+
diffFile.initSyntax();
|
|
325
332
|
diffFile.notifyAll();
|
|
326
|
-
} else {
|
|
327
|
-
diffFile.initSyntax({ registerHighlighter: finalHighlighter });
|
|
328
|
-
if (finalHighlighter.type !== "class") diffFile.notifyAll();
|
|
329
333
|
}
|
|
330
334
|
}
|
|
331
335
|
}, [diffFile, props.diffViewHighlight, registerHighlighter, diffViewTheme]);
|