diff --git a/Tool/webtool/index.html b/Tool/webtool/index.html index 8388c4b..cbcdcdc 100644 --- a/Tool/webtool/index.html +++ b/Tool/webtool/index.html @@ -2,9 +2,9 @@ - + - Vite + Vue + 文件同步
diff --git a/Tool/webtool/package.json b/Tool/webtool/package.json index 84f4a3f..a1a30bd 100644 --- a/Tool/webtool/package.json +++ b/Tool/webtool/package.json @@ -9,6 +9,8 @@ "preview": "vite preview" }, "dependencies": { + "monaco-editor": "0.33.0", + "monaco-editor-vue3": "^0.1.10", "vue": "^3.4.21" }, "devDependencies": { diff --git a/Tool/webtool/public/sync.svg b/Tool/webtool/public/sync.svg new file mode 100644 index 0000000..5f698f4 --- /dev/null +++ b/Tool/webtool/public/sync.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tool/webtool/public/vite.svg b/Tool/webtool/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/Tool/webtool/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Tool/webtool/src/App.vue b/Tool/webtool/src/App.vue index 52568c8..46e47de 100644 --- a/Tool/webtool/src/App.vue +++ b/Tool/webtool/src/App.vue @@ -1,31 +1,44 @@ - - + + diff --git a/Tool/webtool/src/assets/sync.svg b/Tool/webtool/src/assets/sync.svg new file mode 100644 index 0000000..5f698f4 --- /dev/null +++ b/Tool/webtool/src/assets/sync.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tool/webtool/src/assets/vue.svg b/Tool/webtool/src/assets/vue.svg deleted file mode 100644 index 770e9d3..0000000 --- a/Tool/webtool/src/assets/vue.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Tool/webtool/src/components/HelloWorld.vue b/Tool/webtool/src/components/HelloWorld.vue deleted file mode 100644 index f5e4f53..0000000 --- a/Tool/webtool/src/components/HelloWorld.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/Tool/webtool/src/main.js b/Tool/webtool/src/main.js index 2425c0f..1c58693 100644 --- a/Tool/webtool/src/main.js +++ b/Tool/webtool/src/main.js @@ -1,5 +1,27 @@ -import { createApp } from 'vue' -import './style.css' -import App from './App.vue' +import { createApp } from 'vue'; +import './style.css'; +import App from './App.vue'; +import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'; +import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'; +import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'; +import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'; -createApp(App).mount('#app') +self.MonacoEnvironment = { + getWorker(_, label) { + if (label === 'json') { + return new jsonWorker(); + } + if (label === 'css' || label === 'scss' || label === 'less') { + return new cssWorker(); + } + if (label === 'html' || label === 'handlebars' || label === 'razor') { + return new htmlWorker(); + } + if (label === 'typescript' || label === 'javascript') { + return new tsWorker(); + } + return new editorWorker(); + }, +}; +createApp(App).mount('#app');