@git-diff-view/react 0.0.37 → 0.0.39

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/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.37",
6
+ "version": "0.0.39",
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.36",
64
+ "@git-diff-view/core": "^0.0.39",
65
65
  "@types/hast": "^3.0.0",
66
66
  "fast-diff": "^1.3.0",
67
67
  "highlight.js": "^11.11.0",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
2
2
  /* eslint-disable @typescript-eslint/ban-ts-comment */
3
- import { DiffFile, _cacheMap, SplitSide, highlighter as buildInHighlighter } from "@git-diff-view/core";
3
+ import { DiffFile, _cacheMap, SplitSide } from "@git-diff-view/core";
4
4
  import { diffFontSizeName, DiffModeEnum } from "@git-diff-view/utils";
5
5
  import { memo, useEffect, useMemo, forwardRef, useImperativeHandle, useRef } from "react";
6
6
  import * as React from "react";
@@ -315,17 +315,18 @@ const DiffViewWithRef = <T extends unknown>(
315
315
  if (!diffFile) return;
316
316
 
317
317
  if (props.diffViewHighlight) {
318
- const finalHighlighter = registerHighlighter || buildInHighlighter;
319
-
320
- if (
321
- finalHighlighter.name !== diffFile._getHighlighterName() ||
322
- finalHighlighter.type !== diffFile._getHighlighterType()
323
- ) {
324
- diffFile.initSyntax({ registerHighlighter: finalHighlighter });
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 (diffFile._getHighlighterType() !== "class") {
328
+ diffFile.initSyntax();
325
329
  diffFile.notifyAll();
326
- } else {
327
- diffFile.initSyntax({ registerHighlighter: finalHighlighter });
328
- if (finalHighlighter.type !== "class") diffFile.notifyAll();
329
330
  }
330
331
  }
331
332
  }, [diffFile, props.diffViewHighlight, registerHighlighter, diffViewTheme]);