@@ -58,7 +58,12 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
5858 attachExpandUpDownButton ( loadMoreLine . children [ 0 ] as HTMLElement , 'down' ) ;
5959 } ;
6060
61- const insertIncrementCodeForDoubleColumn = ( code : string , direction : 'up' | 'down' , referenceDom : HTMLElement | null | undefined ) => {
61+ const insertIncrementCodeForDoubleColumn = (
62+ code : string ,
63+ direction : 'up' | 'down' ,
64+ referenceDom : HTMLElement | null | undefined ,
65+ options : Record < string , any >
66+ ) => {
6267 if ( ! referenceDom ) {
6368 return ;
6469 }
@@ -69,7 +74,7 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
6974 const prefix = '--- updated_at\tJan 1, 2019, 0:0:0 AM\n+++ updated_at\tJan 1, 2019, 0:0:0 AM\n' ;
7075 const container = document . createElement ( 'div' ) ;
7176 // 解析code
72- parseDiffCode ( container , prefix + code , outputFormat . value , true ) ;
77+ parseDiffCode ( container , prefix + code , outputFormat . value , options , true ) ;
7378
7479 const trNodes = Array . from ( container . querySelectorAll ( 'tr' ) ) ;
7580 const expandLine = trNodes . find ( ( element ) => ( element . children [ 1 ] as HTMLElement ) ?. innerText . trim ( ) . match ( ExpandLineReg ) ) ;
@@ -158,7 +163,12 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
158163 attachExpandUpDownButton ( loadMoreLine . children [ 0 ] as HTMLElement , 'down' ) ;
159164 } ;
160165
161- const insertIncrementCode = ( code : string , direction : 'up' | 'down' , referenceDom : HTMLElement | null | undefined ) => {
166+ const insertIncrementCode = (
167+ code : string ,
168+ direction : 'up' | 'down' ,
169+ referenceDom : HTMLElement | null | undefined ,
170+ options : Record < string , any >
171+ ) => {
162172 if ( ! referenceDom ) {
163173 return ;
164174 }
@@ -169,7 +179,7 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
169179 const prefix = '--- updated_at\tJan 1, 2019, 0:0:0 AM\n+++ updated_at\tJan 1, 2019, 0:0:0 AM\n' ;
170180 const container = document . createElement ( 'div' ) ;
171181 // 解析code
172- parseDiffCode ( container , prefix + code , outputFormat . value , true ) ;
182+ parseDiffCode ( container , prefix + code , outputFormat . value , options , true ) ;
173183
174184 const trNodes = Array . from ( container . querySelectorAll ( 'tr' ) ) ;
175185 const expandLine = trNodes . find ( ( element ) => ( element . children [ 1 ] as HTMLElement ) ?. innerText . trim ( ) . match ( ExpandLineReg ) ) ;
@@ -213,7 +223,7 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
213223 }
214224 } ;
215225
216- const onExpandButtonClick = ( e : Event ) => {
226+ const onExpandButtonClick = ( e : Event , options : Record < string , any > ) => {
217227 const composedPath = e . composedPath ( ) as HTMLElement [ ] ;
218228 const expandIconDom = composedPath . find ( ( element ) => element . classList ?. contains ( 'expand-icon' ) ) ;
219229 if ( expandIconDom ) {
@@ -224,8 +234,8 @@ export function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: C
224234 const [ leftLineStart , leftLineEnd , rightLineStart , rightLineEnd ] = getLineNumberFromDataset ( expandIconDom , expandThreshold . value ) ;
225235 expandLoader ?. value ?.( [ leftLineStart , leftLineEnd , rightLineStart , rightLineEnd ] , ( code : string ) => {
226236 outputFormat . value === 'line-by-line'
227- ? insertIncrementCode ( code , direction , expandIconDom . parentElement ?. parentElement )
228- : insertIncrementCodeForDoubleColumn ( code , direction , expandIconDom . parentElement ?. parentElement ) ;
237+ ? insertIncrementCode ( code , direction , expandIconDom . parentElement ?. parentElement , options )
238+ : insertIncrementCodeForDoubleColumn ( code , direction , expandIconDom . parentElement ?. parentElement , options ) ;
229239 } ) ;
230240 }
231241 } ;
0 commit comments