open files in vscode in development

This commit is contained in:
Philipp Kühn
2020-10-30 18:11:54 +01:00
parent 1ab817295c
commit 5723b1b761
3 changed files with 16 additions and 0 deletions

View File

@@ -1,5 +1,13 @@
export default function (Vue, options, context) { export default function (Vue, options, context) {
Vue.mixin({
data() {
return {
cwd: options.cwd,
}
},
})
context.router.afterEach(to => { context.router.afterEach(to => {
if (to.hash) { if (to.hash) {
setTimeout(() => { setTimeout(() => {

View File

@@ -52,6 +52,10 @@ const globby = require('globby')
module.exports = function (api) { module.exports = function (api) {
api.setClientOptions({
cwd: process.cwd(),
})
api.loadSource(({ addCollection }) => { api.loadSource(({ addCollection }) => {
const appCollection = addCollection({ typeName: 'Package' }) const appCollection = addCollection({ typeName: 'Package' })

View File

@@ -214,6 +214,10 @@ export default {
const { currentPath } = this const { currentPath } = this
const filePath = currentPath === '' ? '/introduction' : currentPath const filePath = currentPath === '' ? '/introduction' : currentPath
if (process.env.NODE_ENV === 'development') {
return `vscode://file${this.cwd}/src/docPages${filePath}.md`
}
return `https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages${filePath}.md` return `https://github.com/ueberdosis/tiptap-next/blob/main/docs/src/docPages${filePath}.md`
}, },
}, },