File tree Expand file tree Collapse file tree 10 files changed +15
-4
lines changed
svelte/src/lib/components Expand file tree Collapse file tree 10 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,7 @@ export declare class DiffFile {
212212 _getHighlighterType : ( ) => string ;
213213 _getIsPureDiffRender : ( ) => boolean ;
214214 _getTheme : ( ) => "light" | "dark" ;
215+ _getIsCloned : ( ) => boolean ;
215216 _addClonedInstance : ( instance : DiffFile ) => void ;
216217 _notifyOthers : ( instance : DiffFile ) => void ;
217218 _delClonedInstance : ( instance : DiffFile ) => void ;
Original file line number Diff line number Diff line change @@ -134,6 +134,8 @@ export class DiffFile {
134134
135135 #highlighterType?: string ;
136136
137+ #isCloned: boolean = false ;
138+
137139 #theme: "light" | "dark" = "light" ;
138140
139141 #hasExpandSplitAll = { state : false } ;
@@ -1660,6 +1662,8 @@ export class DiffFile {
16601662 // mark this instance as a merged instance
16611663 this . #composeByMerge = true ;
16621664
1665+ this . #isCloned = true ;
1666+
16631667 if ( __DEV__ && this . _version_ !== data . version ) {
16641668 console . error ( "the version of the `diffInstance` is not match, some error may happen" ) ;
16651669 }
@@ -1681,6 +1685,8 @@ export class DiffFile {
16811685
16821686 _getTheme = ( ) => this . #theme;
16831687
1688+ _getIsCloned = ( ) => this . #isCloned;
1689+
16841690 _addClonedInstance = ( instance : DiffFile ) => {
16851691 const updateFunc = ( ) => {
16861692 this . _notifyOthers ( instance ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ export declare class DiffFile {
210210 _getHighlighterType : ( ) => string ;
211211 _getIsPureDiffRender : ( ) => boolean ;
212212 _getTheme : ( ) => "light" | "dark" ;
213+ _getIsCloned : ( ) => boolean ;
213214 _addClonedInstance : ( instance : DiffFile ) => void ;
214215 _notifyOthers : ( instance : DiffFile ) => void ;
215216 _delClonedInstance : ( instance : DiffFile ) => void ;
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ export declare class DiffFile {
210210 _getHighlighterType : ( ) => string ;
211211 _getIsPureDiffRender : ( ) => boolean ;
212212 _getTheme : ( ) => "light" | "dark" ;
213+ _getIsCloned : ( ) => boolean ;
213214 _addClonedInstance : ( instance : DiffFile ) => void ;
214215 _notifyOthers : ( instance : DiffFile ) => void ;
215216 _delClonedInstance : ( instance : DiffFile ) => void ;
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ const DiffViewWithRef = <T extends unknown>(
325325 diffFile . notifyAll ( ) ;
326326 }
327327 } else if (
328- diffFile . _getHighlighterName ( ) !== buildInHighlighter . name ||
328+ ( ! diffFile . _getIsCloned ( ) && diffFile . _getHighlighterName ( ) !== buildInHighlighter . name ) ||
329329 diffFile . _getHighlighterType ( ) !== "class"
330330 ) {
331331 diffFile . initSyntax ( ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ export declare class DiffFile {
210210 _getHighlighterType : ( ) => string ;
211211 _getIsPureDiffRender : ( ) => boolean ;
212212 _getTheme : ( ) => "light" | "dark" ;
213+ _getIsCloned : ( ) => boolean ;
213214 _addClonedInstance : ( instance : DiffFile ) => void ;
214215 _notifyOthers : ( instance : DiffFile ) => void ;
215216 _delClonedInstance : ( instance : DiffFile ) => void ;
Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ const InternalDiffView = <T extends unknown>(props: DiffViewProps<T>) => {
207207 currentDiffFile . notifyAll ( ) ;
208208 }
209209 } else if (
210- currentDiffFile . _getHighlighterName ( ) !== buildInHighlighter . name ||
210+ ( ! currentDiffFile . _getIsCloned ( ) && currentDiffFile . _getHighlighterName ( ) !== buildInHighlighter . name ) ||
211211 currentDiffFile . _getHighlighterType ( ) !== "class"
212212 ) {
213213 currentDiffFile . initSyntax ( ) ;
Original file line number Diff line number Diff line change 175175 diffFile .notifyAll ();
176176 }
177177 } else if (
178- diffFile ._getHighlighterName () !== buildInHighlighter .name ||
178+ ( ! diffFile ._getIsCloned () && diffFile . _getHighlighterName () !== buildInHighlighter .name ) ||
179179 diffFile ._getHighlighterType () !== ' class'
180180 ) {
181181 diffFile .initSyntax ();
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ export declare class DiffFile {
210210 _getHighlighterType : ( ) => string ;
211211 _getIsPureDiffRender : ( ) => boolean ;
212212 _getTheme : ( ) => "light" | "dark" ;
213+ _getIsCloned : ( ) => boolean ;
213214 _addClonedInstance : ( instance : DiffFile ) => void ;
214215 _notifyOthers : ( instance : DiffFile ) => void ;
215216 _delClonedInstance : ( instance : DiffFile ) => void ;
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ export const DiffView = defineComponent<
176176 instance . notifyAll ( ) ;
177177 }
178178 } else if (
179- instance . _getHighlighterName ( ) !== buildInHighlighter . name ||
179+ ( ! instance . _getIsCloned ( ) && instance . _getHighlighterName ( ) !== buildInHighlighter . name ) ||
180180 instance . _getHighlighterType ( ) !== "class"
181181 ) {
182182 instance . initSyntax ( { } ) ;
You can’t perform that action at this time.
0 commit comments