File tree Expand file tree Collapse file tree
src/monkey/gitlab-enhance/merge_requests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import lodash from 'lodash'
21import * as MdTools from './MdTools'
32export { MdTools }
43
@@ -23,6 +22,10 @@ type TableOptions = Partial<LevelOptions>
2322type HyperlinkOptions = Partial < LevelOptions & { anchorKey : string } >
2423type ImageOptions = Partial < LevelOptions & { anchorKey : string , alt : string } >
2524
25+ function cloneDeep < T > ( value : T ) : T {
26+ return JSON . parse ( JSON . stringify ( value ) ) as T
27+ }
28+
2629class Template {
2730 protected templateContent : string
2831 protected anchorMap : Record < string , string > = { }
@@ -153,7 +156,7 @@ class Template {
153156 this . templateContent += MdTools . enter ( )
154157 }
155158 public modify ( callback : ( content : string ) => string ) {
156- this . templateContent = callback ( lodash . cloneDeep ( this . templateContent ) )
159+ this . templateContent = callback ( cloneDeep ( this . templateContent ) )
157160 return this . contentNextUtils
158161 }
159162}
@@ -163,7 +166,7 @@ export const genTemplate = (callback: (utils: Template) => any = (() => { })) =>
163166}
164167
165168export const readTemplate = ( text : string , callback : ( utils : Template ) => any = ( ( ) => { } ) ) => {
166- const templateInst = new Template ( lodash . cloneDeep ( text ) )
169+ const templateInst = new Template ( cloneDeep ( text ) )
167170 callback ( templateInst )
168171 return templateInst [ Symbol . toStringTag ] ( )
169172}
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ const appendAsTitleButton = () => {
1414 } )
1515}
1616
17-
1817if ( location . pathname . endsWith ( '/-/merge_requests/new' ) ) {
1918 setTimeout ( ( ) => {
2019 appendTemplateButton ( )
Original file line number Diff line number Diff line change @@ -92,5 +92,5 @@ export const appendTemplateButton = () => {
9292 } )
9393 } )
9494
95- $ ( '.gl-display-flex :has([for=merge_request_description])' ) . append ( btnElement )
95+ $ ( '* :has(> [for=merge_request_description])' ) . append ( btnElement )
9696}
You can’t perform that action at this time.
0 commit comments