From 53100549d3959d2092d3fd889a481bd94194fc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=BCl=C3=B6p=20Kov=C3=A1cs?= Date: Wed, 22 Jul 2020 21:25:54 +0200 Subject: [PATCH 1/3] fix($theme-default): fix editLink for repos hosted on gitlab.com --- packages/@vuepress/theme-default/components/PageEdit.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/theme-default/components/PageEdit.vue b/packages/@vuepress/theme-default/components/PageEdit.vue index e1ac3ca096..3f1ef8b486 100644 --- a/packages/@vuepress/theme-default/components/PageEdit.vue +++ b/packages/@vuepress/theme-default/components/PageEdit.vue @@ -97,7 +97,7 @@ export default { : `https://github.com/${docsRepo}` return ( base.replace(endingSlashRE, '') - + `/edit` + + (/gitlab.com/.test(repo) ? '/-/edit/' : '/edit') + `/${docsBranch}/` + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + path From c61c6da5b6e8b8709c5085408563c7d20b46bd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=BCl=C3=B6p=20Kov=C3=A1cs?= Date: Thu, 23 Jul 2020 23:04:22 +0200 Subject: [PATCH 2/3] refactor($theme-default): refactor the gitlab edit links --- .../theme-default/components/PageEdit.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/theme-default/components/PageEdit.vue b/packages/@vuepress/theme-default/components/PageEdit.vue index 3f1ef8b486..0538dc72f5 100644 --- a/packages/@vuepress/theme-default/components/PageEdit.vue +++ b/packages/@vuepress/theme-default/components/PageEdit.vue @@ -92,12 +92,24 @@ export default { ) } + const gitlab = /gitlab.com/ + if (gitlab.test(docsRepo)) { + const base = docsRepo + return ( + base.replace(endingSlashRE, '') + + `/-/edit` + + `/${docsBranch}/` + + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + + path + ) + } + const base = outboundRE.test(docsRepo) ? docsRepo : `https://github.com/${docsRepo}` return ( base.replace(endingSlashRE, '') - + (/gitlab.com/.test(repo) ? '/-/edit/' : '/edit') + + '/edit' + `/${docsBranch}/` + (docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') + path From 65bae3de19fc77a2fe76a41799fbd261d202eb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=BCl=C3=B6p=20Kov=C3=A1cs?= Date: Fri, 31 Jul 2020 22:57:47 +0200 Subject: [PATCH 3/3] refactor($theme-default): refactor bitbucket edit links --- packages/@vuepress/theme-default/components/PageEdit.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/theme-default/components/PageEdit.vue b/packages/@vuepress/theme-default/components/PageEdit.vue index 0538dc72f5..38cb425a1a 100644 --- a/packages/@vuepress/theme-default/components/PageEdit.vue +++ b/packages/@vuepress/theme-default/components/PageEdit.vue @@ -80,8 +80,8 @@ export default { methods: { createEditLink (repo, docsRepo, docsDir, docsBranch, path) { const bitbucket = /bitbucket.org/ - if (bitbucket.test(repo)) { - const base = outboundRE.test(docsRepo) ? docsRepo : repo + if (bitbucket.test(docsRepo)) { + const base = docsRepo return ( base.replace(endingSlashRE, '') + `/src`