Skip to content

Commit c61c6da

Browse files
committed
refactor($theme-default): refactor the gitlab edit links
1 parent 5310054 commit c61c6da

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/@vuepress/theme-default/components/PageEdit.vue

+13-1
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,24 @@ export default {
9292
)
9393
}
9494
95+
const gitlab = /gitlab.com/
96+
if (gitlab.test(docsRepo)) {
97+
const base = docsRepo
98+
return (
99+
base.replace(endingSlashRE, '')
100+
+ `/-/edit`
101+
+ `/${docsBranch}/`
102+
+ (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '')
103+
+ path
104+
)
105+
}
106+
95107
const base = outboundRE.test(docsRepo)
96108
? docsRepo
97109
: `https://github.com/${docsRepo}`
98110
return (
99111
base.replace(endingSlashRE, '')
100-
+ (/gitlab.com/.test(repo) ? '/-/edit/' : '/edit')
112+
+ '/edit'
101113
+ `/${docsBranch}/`
102114
+ (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '')
103115
+ path

0 commit comments

Comments
 (0)