@git-diff-view/react 0.0.32 → 0.0.34
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 +34 -2
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +34 -2
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +1 -1
- package/dist/esm/index.mjs +34 -2
- package/dist/esm/index.mjs.map +1 -1
- package/index.d.ts +59 -100
- package/package.json +8 -8
- package/src/components/DiffSplitViewNormal.tsx +7 -0
- package/src/components/DiffSplitViewWrap.tsx +7 -1
- package/src/components/DiffUnifiedView.tsx +7 -1
- package/src/index.ts +2 -0
- package/styles/diff-view.css +1 -1
package/index.d.ts
CHANGED
|
@@ -38,16 +38,16 @@ declare class File$1 {
|
|
|
38
38
|
doRaw(): void;
|
|
39
39
|
}
|
|
40
40
|
declare const lowlight: {
|
|
41
|
-
highlight: (language: string, value: string, options?: Readonly<import("lowlight").Options>) => import("hast").Root;
|
|
42
|
-
highlightAuto: (value: string, options?: Readonly<import("lowlight").AutoOptions>) => import("hast").Root;
|
|
43
|
-
listLanguages: () => string
|
|
41
|
+
highlight: (language: string, value: string, options?: Readonly<import("lowlight").Options> | null | undefined) => import("hast").Root;
|
|
42
|
+
highlightAuto: (value: string, options?: Readonly<import("lowlight").AutoOptions> | null | undefined) => import("hast").Root;
|
|
43
|
+
listLanguages: () => Array<string>;
|
|
44
44
|
register: {
|
|
45
45
|
(grammars: Readonly<Record<string, import("highlight.js").LanguageFn>>): undefined;
|
|
46
46
|
(name: string, grammar: import("highlight.js").LanguageFn): undefined;
|
|
47
47
|
};
|
|
48
48
|
registerAlias: {
|
|
49
|
-
(aliases: Readonly<Record<string, string |
|
|
50
|
-
(language: string, alias: string |
|
|
49
|
+
(aliases: Readonly<Record<string, ReadonlyArray<string> | string>>): undefined;
|
|
50
|
+
(language: string, alias: ReadonlyArray<string> | string): undefined;
|
|
51
51
|
};
|
|
52
52
|
registered: (aliasOrName: string) => boolean;
|
|
53
53
|
};
|
|
@@ -76,8 +76,32 @@ export declare class DiffFile {
|
|
|
76
76
|
additionLength: number;
|
|
77
77
|
deletionLength: number;
|
|
78
78
|
hasSomeLineCollapsed: boolean;
|
|
79
|
-
static createInstance(data:
|
|
80
|
-
|
|
79
|
+
static createInstance(data: {
|
|
80
|
+
oldFile?: {
|
|
81
|
+
fileName?: string | null;
|
|
82
|
+
fileLang?: DiffHighlighterLang | null;
|
|
83
|
+
content?: string | null;
|
|
84
|
+
};
|
|
85
|
+
newFile?: {
|
|
86
|
+
fileName?: string | null;
|
|
87
|
+
fileLang?: DiffHighlighterLang | null;
|
|
88
|
+
content?: string | null;
|
|
89
|
+
};
|
|
90
|
+
hunks?: string[];
|
|
91
|
+
}, bundle?: ReturnType<DiffFile["getBundle"] | DiffFile["_getFullBundle"]>): DiffFile;
|
|
92
|
+
static createInstance(data: {
|
|
93
|
+
oldFile?: {
|
|
94
|
+
fileName?: string | null;
|
|
95
|
+
fileLang?: string | null;
|
|
96
|
+
content?: string | null;
|
|
97
|
+
};
|
|
98
|
+
newFile?: {
|
|
99
|
+
fileName?: string | null;
|
|
100
|
+
fileLang?: string | null;
|
|
101
|
+
content?: string | null;
|
|
102
|
+
};
|
|
103
|
+
hunks?: string[];
|
|
104
|
+
}, bundle?: ReturnType<DiffFile["getBundle"] | DiffFile["_getFullBundle"]>): DiffFile;
|
|
81
105
|
constructor(_oldFileName: string, _oldFileContent: string, _newFileName: string, _newFileContent: string, _diffList: string[], _oldFileLang?: DiffHighlighterLang, _newFileLang?: DiffHighlighterLang, uuid?: string);
|
|
82
106
|
constructor(_oldFileName: string, _oldFileContent: string, _newFileName: string, _newFileContent: string, _diffList: string[], _oldFileLang?: string, _newFileLang?: string, uuid?: string);
|
|
83
107
|
initId(): void;
|
|
@@ -115,12 +139,16 @@ export declare class DiffFile {
|
|
|
115
139
|
value: string;
|
|
116
140
|
template?: string;
|
|
117
141
|
};
|
|
118
|
-
getOldSyntaxLine: (lineNumber: number) =>
|
|
142
|
+
getOldSyntaxLine: (lineNumber: number) => SyntaxLine & {
|
|
143
|
+
template?: string;
|
|
144
|
+
};
|
|
119
145
|
getNewPlainLine: (lineNumber: number) => {
|
|
120
146
|
value: string;
|
|
121
147
|
template?: string;
|
|
122
148
|
};
|
|
123
|
-
getNewSyntaxLine: (lineNumber: number) =>
|
|
149
|
+
getNewSyntaxLine: (lineNumber: number) => SyntaxLine & {
|
|
150
|
+
template?: string;
|
|
151
|
+
};
|
|
124
152
|
subscribe: (listener: (() => void) & {
|
|
125
153
|
isSyncExternal?: boolean;
|
|
126
154
|
}) => () => void;
|
|
@@ -138,7 +166,9 @@ export declare class DiffFile {
|
|
|
138
166
|
value: string;
|
|
139
167
|
template?: string;
|
|
140
168
|
}>;
|
|
141
|
-
oldFileSyntaxLines: Record<number,
|
|
169
|
+
oldFileSyntaxLines: Record<number, SyntaxLine & {
|
|
170
|
+
template?: string;
|
|
171
|
+
}>;
|
|
142
172
|
oldFilePlaceholderLines: Record<string, boolean>;
|
|
143
173
|
newFileLines: Record<number, string>;
|
|
144
174
|
newFileDiffLines: Record<string, DiffLineItem>;
|
|
@@ -146,7 +176,9 @@ export declare class DiffFile {
|
|
|
146
176
|
value: string;
|
|
147
177
|
template?: string;
|
|
148
178
|
}>;
|
|
149
|
-
newFileSyntaxLines: Record<number,
|
|
179
|
+
newFileSyntaxLines: Record<number, SyntaxLine & {
|
|
180
|
+
template?: string;
|
|
181
|
+
}>;
|
|
150
182
|
newFilePlaceholderLines: Record<string, boolean>;
|
|
151
183
|
splitLineLength: number;
|
|
152
184
|
unifiedLineLength: number;
|
|
@@ -196,7 +228,9 @@ export declare class DiffFile {
|
|
|
196
228
|
value: string;
|
|
197
229
|
template?: string;
|
|
198
230
|
}>;
|
|
199
|
-
oldFileSyntaxLines: Record<number,
|
|
231
|
+
oldFileSyntaxLines: Record<number, SyntaxLine & {
|
|
232
|
+
template?: string;
|
|
233
|
+
}>;
|
|
200
234
|
oldFilePlaceholderLines: Record<string, boolean>;
|
|
201
235
|
newFileLines: Record<number, string>;
|
|
202
236
|
newFileDiffLines: Record<string, DiffLineItem>;
|
|
@@ -204,7 +238,9 @@ export declare class DiffFile {
|
|
|
204
238
|
value: string;
|
|
205
239
|
template?: string;
|
|
206
240
|
}>;
|
|
207
|
-
newFileSyntaxLines: Record<number,
|
|
241
|
+
newFileSyntaxLines: Record<number, SyntaxLine & {
|
|
242
|
+
template?: string;
|
|
243
|
+
}>;
|
|
208
244
|
newFilePlaceholderLines: Record<string, boolean>;
|
|
209
245
|
splitLineLength: number;
|
|
210
246
|
unifiedLineLength: number;
|
|
@@ -416,14 +452,12 @@ export declare class DiffParser {
|
|
|
416
452
|
}
|
|
417
453
|
/** How many new lines will be added to a diff hunk by default. */
|
|
418
454
|
export declare const DefaultDiffExpansionStep = 40;
|
|
419
|
-
/**
|
|
420
|
-
* Regular expression matching invisible bidirectional Unicode characters that
|
|
421
|
-
* may be interpreted or compiled differently than what it appears. More info:
|
|
422
|
-
* https://github.co/hiddenchars
|
|
423
|
-
*/
|
|
424
|
-
export declare const HiddenBidiCharsRegex: RegExp;
|
|
425
455
|
export declare const _cacheMap: Cache$1<string, File$1>;
|
|
426
456
|
export declare const changeDefaultComposeLength: (compose: number) => void;
|
|
457
|
+
/**
|
|
458
|
+
* Change the maximum length of a line to ignore line diff.
|
|
459
|
+
*/
|
|
460
|
+
export declare const changeMaxLengthToIgnoreLineDiff: (length: number) => void;
|
|
427
461
|
export declare const checkCurrentLineIsHidden: (diffFile: DiffFile, lineNumber: number, side: SplitSide) => {
|
|
428
462
|
split: boolean;
|
|
429
463
|
unified: boolean;
|
|
@@ -432,14 +466,9 @@ export declare const checkDiffLineIncludeChange: (diffLine?: DiffLine) => boolea
|
|
|
432
466
|
export declare const defaultTransform: (content: string) => string;
|
|
433
467
|
export declare const disableCache: () => void;
|
|
434
468
|
export declare const getCurrentComposeLength: () => number;
|
|
435
|
-
export declare const getDiffRange: (additions: DiffLine[], deletions: DiffLine[], { getAdditionRaw, getDeletionRaw, getAdditionSyntax, getDeletionSyntax, }: {
|
|
436
|
-
getAdditionRaw: (lineNumber: number) => string;
|
|
437
|
-
getDeletionRaw: (lineNumber: number) => string;
|
|
438
|
-
getAdditionSyntax: (lineNumber: number) => SyntaxLineWithTemplate;
|
|
439
|
-
getDeletionSyntax: (lineNumber: number) => SyntaxLineWithTemplate;
|
|
440
|
-
}) => void;
|
|
441
469
|
export declare const getEnableFastDiffTemplate: () => boolean;
|
|
442
470
|
export declare const getLang: (fileName: string) => string;
|
|
471
|
+
export declare const getMaxLengthToIgnoreLineDiff: () => number;
|
|
443
472
|
export declare const getPlainDiffTemplate: ({ diffLine, rawLine, operator, }: {
|
|
444
473
|
diffLine: DiffLine;
|
|
445
474
|
rawLine: string;
|
|
@@ -455,12 +484,12 @@ export declare const getSplitContentLines: (diffFile: DiffFile) => DiffSplitCont
|
|
|
455
484
|
export declare const getSplitLines: (diffFile: DiffFile) => DiffSplitLineItem[];
|
|
456
485
|
export declare const getSyntaxDiffTemplate: ({ diffLine, syntaxLine, operator, }: {
|
|
457
486
|
diffLine: DiffLine;
|
|
458
|
-
syntaxLine:
|
|
487
|
+
syntaxLine: SyntaxLine;
|
|
459
488
|
operator: "add" | "del";
|
|
460
489
|
}) => void;
|
|
461
490
|
export declare const getSyntaxDiffTemplateByFastDiff: ({ diffLine, syntaxLine, operator, }: {
|
|
462
491
|
diffLine: DiffLine;
|
|
463
|
-
syntaxLine:
|
|
492
|
+
syntaxLine: SyntaxLine;
|
|
464
493
|
operator: "add" | "del";
|
|
465
494
|
}) => void;
|
|
466
495
|
export declare const getSyntaxLineTemplate: (line: SyntaxLine) => string;
|
|
@@ -480,7 +509,6 @@ export declare const highlighter: DiffHighlighter;
|
|
|
480
509
|
* ```
|
|
481
510
|
*/
|
|
482
511
|
export declare const isTransformEnabled: () => boolean;
|
|
483
|
-
export declare const numIterator: <T>(num: number, cb: (index: number) => T) => T[];
|
|
484
512
|
export declare const parseInstance: DiffParser;
|
|
485
513
|
export declare const processAST: (ast: DiffAST) => {
|
|
486
514
|
syntaxFileObject: Record<number, SyntaxLine>;
|
|
@@ -512,6 +540,7 @@ export declare const processTransformForFile: (content: string) => string;
|
|
|
512
540
|
export declare const processTransformTemplateContent: (content: string) => string;
|
|
513
541
|
export declare const resetDefaultComposeLength: () => void;
|
|
514
542
|
export declare const resetEnableFastDiffTemplate: () => void;
|
|
543
|
+
export declare const resetMaxLengthToIgnoreLineDiff: () => void;
|
|
515
544
|
/**
|
|
516
545
|
* Resets all transformation functions to their default state and disables transformation.
|
|
517
546
|
*
|
|
@@ -592,27 +621,11 @@ export declare enum SplitSide {
|
|
|
592
621
|
}
|
|
593
622
|
export declare function _getAST(raw: string, fileName?: string, lang?: DiffHighlighterLang, theme?: "light" | "dark"): DiffAST;
|
|
594
623
|
export declare function _getAST(raw: string, fileName?: string, lang?: string, theme?: "light" | "dark"): DiffAST;
|
|
595
|
-
export declare function assertNever(_: never, message: string): never;
|
|
596
624
|
export declare function diffChanges(addition: DiffLine, deletion: DiffLine): {
|
|
597
625
|
addRange: DiffRange;
|
|
598
626
|
delRange: DiffRange;
|
|
599
627
|
};
|
|
600
628
|
export declare function escapeHtml(string: unknown): string;
|
|
601
|
-
export declare function getFile(raw: string, lang: DiffHighlighterLang, theme: "light" | "dark", fileName?: string, uuid?: string): File$1;
|
|
602
|
-
export declare function getFile(raw: string, lang: string, theme: "light" | "dark", fileName?: string, uuid?: string): File$1;
|
|
603
|
-
/**
|
|
604
|
-
* Calculates whether or not a hunk header can be expanded up, down, both, or if
|
|
605
|
-
* the space represented by the hunk header is short and expansion there would
|
|
606
|
-
* mean merging with the hunk above.
|
|
607
|
-
*
|
|
608
|
-
* @param hunkIndex Index of the hunk to evaluate within the whole diff.
|
|
609
|
-
* @param hunkHeader Header of the hunk to evaluate.
|
|
610
|
-
* @param previousHunk Hunk previous to the one to evaluate. Null if the
|
|
611
|
-
* evaluated hunk is the first one.
|
|
612
|
-
*/
|
|
613
|
-
export declare function getHunkHeaderExpansionType(hunkIndex: number, hunkHeader: DiffHunkHeader, previousHunk: DiffHunk | null): DiffHunkExpansionType;
|
|
614
|
-
/** Utility function for getting the digit count of the largest line number in an array of diff hunks */
|
|
615
|
-
export declare function getLargestLineNumber(hunks: DiffHunk[]): number;
|
|
616
629
|
/** Get the changed ranges in the strings, relative to each other. */
|
|
617
630
|
export declare function relativeChanges(addition: DiffLine, deletion: DiffLine): {
|
|
618
631
|
addRange: IRange;
|
|
@@ -742,32 +755,6 @@ export type DiffUnifiedLineItem = {
|
|
|
742
755
|
index: number;
|
|
743
756
|
lineNumber: number;
|
|
744
757
|
};
|
|
745
|
-
export type FileData_1 = {
|
|
746
|
-
oldFile?: {
|
|
747
|
-
fileName?: string | null;
|
|
748
|
-
fileLang?: DiffHighlighterLang | null;
|
|
749
|
-
content?: string | null;
|
|
750
|
-
};
|
|
751
|
-
newFile?: {
|
|
752
|
-
fileName?: string | null;
|
|
753
|
-
fileLang?: DiffHighlighterLang | null;
|
|
754
|
-
content?: string | null;
|
|
755
|
-
};
|
|
756
|
-
hunks?: string[];
|
|
757
|
-
};
|
|
758
|
-
export type FileData_2 = {
|
|
759
|
-
oldFile?: {
|
|
760
|
-
fileName?: string | null;
|
|
761
|
-
fileLang?: string | null;
|
|
762
|
-
content?: string | null;
|
|
763
|
-
};
|
|
764
|
-
newFile?: {
|
|
765
|
-
fileName?: string | null;
|
|
766
|
-
fileLang?: string | null;
|
|
767
|
-
content?: string | null;
|
|
768
|
-
};
|
|
769
|
-
hunks?: string[];
|
|
770
|
-
};
|
|
771
758
|
export type HunkInfo = {
|
|
772
759
|
oldStartIndex: number;
|
|
773
760
|
newStartIndex: number;
|
|
@@ -924,36 +911,8 @@ declare const createDiffConfigStore: (props: DiffViewProps<any> & {
|
|
|
924
911
|
setOnAddWidgetClick: (_onAddWidgetClick: {
|
|
925
912
|
current: (lineNumber: number, side: SplitSide) => void;
|
|
926
913
|
}) => (lineNumber: number, side: SplitSide) => void;
|
|
927
|
-
onCreateUseWidgetHook: import("reactivity-store").Ref<(hook:
|
|
928
|
-
|
|
929
|
-
widgetLineNumber: import("reactivity-store").Ref<number, number>;
|
|
930
|
-
setWidget: ({ side, lineNumber }: {
|
|
931
|
-
side?: SplitSide;
|
|
932
|
-
lineNumber?: number;
|
|
933
|
-
}) => void;
|
|
934
|
-
}>) => void, (hook: import("reactivity-store").UseSelectorWithStore<{
|
|
935
|
-
widgetSide: import("reactivity-store").Ref<SplitSide, SplitSide>;
|
|
936
|
-
widgetLineNumber: import("reactivity-store").Ref<number, number>;
|
|
937
|
-
setWidget: ({ side, lineNumber }: {
|
|
938
|
-
side?: SplitSide;
|
|
939
|
-
lineNumber?: number;
|
|
940
|
-
}) => void;
|
|
941
|
-
}>) => void>;
|
|
942
|
-
setOnCreateUseWidgetHook: (_onCreateUseWidgetHook: (hook: import("reactivity-store").UseSelectorWithStore<{
|
|
943
|
-
widgetSide: import("reactivity-store").Ref<SplitSide, SplitSide>;
|
|
944
|
-
widgetLineNumber: import("reactivity-store").Ref<number, number>;
|
|
945
|
-
setWidget: ({ side, lineNumber }: {
|
|
946
|
-
side?: SplitSide;
|
|
947
|
-
lineNumber?: number;
|
|
948
|
-
}) => void;
|
|
949
|
-
}>) => void) => (hook: import("reactivity-store").UseSelectorWithStore<{
|
|
950
|
-
widgetSide: import("reactivity-store").Ref<SplitSide, SplitSide>;
|
|
951
|
-
widgetLineNumber: import("reactivity-store").Ref<number, number>;
|
|
952
|
-
setWidget: ({ side, lineNumber }: {
|
|
953
|
-
side?: SplitSide;
|
|
954
|
-
lineNumber?: number;
|
|
955
|
-
}) => void;
|
|
956
|
-
}>) => void;
|
|
914
|
+
onCreateUseWidgetHook: import("reactivity-store").Ref<(hook: ReturnType<typeof createDiffWidgetStore>) => void, (hook: ReturnType<typeof createDiffWidgetStore>) => void>;
|
|
915
|
+
setOnCreateUseWidgetHook: (_onCreateUseWidgetHook: (hook: ReturnType<typeof createDiffWidgetStore>) => void) => (hook: ReturnType<typeof createDiffWidgetStore>) => void;
|
|
957
916
|
}>;
|
|
958
917
|
declare const createDiffWidgetStore: (useDiffContextRef: RefObject<ReturnType<typeof createDiffConfigStore>>) => import("reactivity-store").UseSelectorWithStore<{
|
|
959
918
|
widgetSide: import("reactivity-store").Ref<SplitSide, SplitSide>;
|
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.34",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
"react diff component"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@git-diff-view/core": "^0.0.
|
|
64
|
+
"@git-diff-view/core": "^0.0.34",
|
|
65
65
|
"@types/hast": "^3.0.0",
|
|
66
66
|
"fast-diff": "^1.3.0",
|
|
67
67
|
"highlight.js": "^11.11.0",
|
|
68
68
|
"lowlight": "^3.3.0",
|
|
69
|
-
"reactivity-store": "^0.3.
|
|
70
|
-
"use-sync-external-store": "^1.
|
|
69
|
+
"reactivity-store": "^0.3.12",
|
|
70
|
+
"use-sync-external-store": "^1.6.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@types/use-sync-external-store": "^
|
|
74
|
-
"autoprefixer": "^10.4.
|
|
73
|
+
"@types/use-sync-external-store": "^1.5.0",
|
|
74
|
+
"autoprefixer": "^10.4.21",
|
|
75
75
|
"postcss": "^8.5.6",
|
|
76
|
-
"react": "^
|
|
77
|
-
"tailwindcss": "^3.4.
|
|
76
|
+
"react": "^19.2.0",
|
|
77
|
+
"tailwindcss": "^3.4.18"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
diffFontSizeName,
|
|
7
7
|
borderColorName,
|
|
8
8
|
diffAsideWidthName,
|
|
9
|
+
getDiffIdFromElement,
|
|
9
10
|
} from "@git-diff-view/utils";
|
|
10
11
|
import { Fragment, memo, useEffect, useRef } from "react";
|
|
11
12
|
import * as React from "react";
|
|
@@ -137,6 +138,12 @@ export const DiffSplitViewNormal = memo(({ diffFile }: { diffFile: DiffFile }) =
|
|
|
137
138
|
return;
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
const id = getDiffIdFromElement(ele as HTMLElement);
|
|
142
|
+
|
|
143
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
140
147
|
while (ele && ele instanceof HTMLElement) {
|
|
141
148
|
const state = ele.getAttribute("data-state");
|
|
142
149
|
const side = ele.getAttribute("data-side");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { type DiffFile, getSplitContentLines } from "@git-diff-view/core";
|
|
3
|
-
import { diffAsideWidthName, diffFontSizeName, removeAllSelection } from "@git-diff-view/utils";
|
|
3
|
+
import { diffAsideWidthName, diffFontSizeName, getDiffIdFromElement, removeAllSelection } from "@git-diff-view/utils";
|
|
4
4
|
import { Fragment, memo, useMemo, useRef } from "react";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
// SEE https://github.com/facebook/react/pull/25231
|
|
@@ -65,6 +65,12 @@ export const DiffSplitViewWrap = memo(({ diffFile }: { diffFile: DiffFile }) =>
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
const id = getDiffIdFromElement(ele as HTMLElement);
|
|
69
|
+
|
|
70
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
while (ele && ele instanceof HTMLElement) {
|
|
69
75
|
const state = ele.getAttribute("data-state");
|
|
70
76
|
const side = ele.getAttribute("data-side");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { getUnifiedContentLine, SplitSide } from "@git-diff-view/core";
|
|
3
|
-
import { diffFontSizeName, removeAllSelection, diffAsideWidthName } from "@git-diff-view/utils";
|
|
3
|
+
import { diffFontSizeName, removeAllSelection, diffAsideWidthName, getDiffIdFromElement } from "@git-diff-view/utils";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { Fragment, memo, useEffect, useMemo, useRef } from "react";
|
|
6
6
|
import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
|
|
@@ -85,6 +85,12 @@ export const DiffUnifiedView = memo(({ diffFile }: { diffFile: DiffFile }) => {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
const id = getDiffIdFromElement(ele as HTMLElement);
|
|
89
|
+
|
|
90
|
+
if (id && id !== `diff-root${diffFile.getId()}`) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
while (ele && ele instanceof HTMLElement) {
|
|
89
95
|
const state = ele.getAttribute("data-state");
|
|
90
96
|
if (state) {
|
package/src/index.ts
CHANGED
package/styles/diff-view.css
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
--tw-contain-paint: ;
|
|
106
106
|
--tw-contain-style: ;
|
|
107
107
|
}/*
|
|
108
|
-
! tailwindcss v3.4.
|
|
108
|
+
! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com
|
|
109
109
|
*//*
|
|
110
110
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
111
111
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|