Skip to content

Commit

Permalink
feat: finish all but state handling of live demo
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Jan 27, 2023
1 parent e8033af commit 9b5421a
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 653 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
rules: {
'no-console': process.env.NODE_ENV !== 'production' ? 0 : 2,
'no-useless-escape': 0,
'no-empty': 0,
indent: ['error', 2]
'no-empty': 0
}
}
1 change: 0 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ module.exports = {
}
}
]
// htmlWhitespaceSensitivity: false
}
27 changes: 27 additions & 0 deletions docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
import { defineClientConfig } from '@vuepress/client'

// @ts-expect-error monaco editor doesn't have types for the workers
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
// @ts-expect-error monaco editor doesn't have types for the workers
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
// @ts-expect-error monaco editor doesn't have types for the workers
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'

export default defineClientConfig({
enhance({ router }) {
self.MonacoEnvironment = {
getWorker(_, label) {
switch (label) {
case 'json':
return new jsonWorker()
case 'typescript':
case 'javascript':
return new tsWorker()
default:
return editorWorker()
}
}
}

router.addRoute('/', {
path: '/ads.txt',
redirect: '',
Expand All @@ -19,3 +40,9 @@ export default defineClientConfig({
})
}
})

declare global {
interface Window {
MonacoEnvironment?: import('monaco-editor').Environment | undefined
}
}
Loading

0 comments on commit 9b5421a

Please sign in to comment.