@@ -87,17 +87,8 @@ export default {
87
87
} else {
88
88
path += ' .md'
89
89
}
90
-
91
90
if (docsRepo && editLinks) {
92
- const base = outboundRE .test (docsRepo)
93
- ? docsRepo
94
- : ` https://github.com/${ docsRepo} `
95
- return (
96
- base .replace (endingSlashRE, ' ' ) +
97
- ` /edit/${ docsBranch} ` +
98
- (docsDir ? ' /' + docsDir .replace (endingSlashRE, ' ' ) : ' ' ) +
99
- path
100
- )
91
+ return this .createEditLink (repo, docsRepo, docsDir, docsBranch, path)
101
92
}
102
93
},
103
94
editLinkText () {
@@ -107,6 +98,34 @@ export default {
107
98
` Edit this page`
108
99
)
109
100
}
101
+ },
102
+ methods: {
103
+ createEditLink (repo , docsRepo , docsDir , docsBranch , path ) {
104
+ const bitbucket = / bitbucket. org/
105
+ if (bitbucket .test (repo)) {
106
+ const base = outboundRE .test (docsRepo)
107
+ ? docsRepo
108
+ : repo
109
+ return (
110
+ base .replace (endingSlashRE, ' ' ) +
111
+ ` /${ docsBranch} ` +
112
+ (docsDir ? ' /' + docsDir .replace (endingSlashRE, ' ' ) : ' ' ) +
113
+ path +
114
+ ` ?mode=edit&spa=0&at=${ docsBranch} &fileviewer=file-view-default`
115
+ )
116
+ }
117
+
118
+ const base = outboundRE .test (docsRepo)
119
+ ? docsRepo
120
+ : ` https://github.com/${ docsRepo} `
121
+
122
+ return (
123
+ base .replace (endingSlashRE, ' ' ) +
124
+ ` /edit/${ docsBranch} ` +
125
+ (docsDir ? ' /' + docsDir .replace (endingSlashRE, ' ' ) : ' ' ) +
126
+ path
127
+ )
128
+ }
110
129
}
111
130
}
112
131
0 commit comments