Compare commits
4
Commits
f8ca6dba67
..
2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25f25ff669 | ||
|
|
f2333f74cb | ||
|
|
d0bad77387 | ||
|
|
ea43e641ce |
No files matched your search
@@ -25,3 +25,5 @@ dist-ssr
|
|||||||
.vscode
|
.vscode
|
||||||
serve
|
serve
|
||||||
miao-directory.exe
|
miao-directory.exe
|
||||||
|
miao-directory-amd64-linux
|
||||||
|
miao-directory-amd64-win.exe
|
||||||
+2
-2
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="./public/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>MDW</title>
|
<title>MiaoDirectory</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,7 @@
|
|||||||
"dev:host": "vite --host 0.0.0.0",
|
"dev:host": "vite --host 0.0.0.0",
|
||||||
"build": "vue-tsc -b && vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"build:auto": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go build && mv ./miao-directory.exe ../",
|
"build:auto": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go build && mv ./miao-directory.exe ../",
|
||||||
|
"build:auto:release": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go env -w GOOS=windows GOARCH=amd64 && go build -o ../miao-directory-amd64-win.exe && go env -w GOOS=linux GOARCH=amd64 && go build -o ../miao-directory-amd64-linux",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -22,7 +23,6 @@
|
|||||||
"@codemirror/lang-vue": "^0.1.3",
|
"@codemirror/lang-vue": "^0.1.3",
|
||||||
"@codemirror/lang-xml": "^6.1.0",
|
"@codemirror/lang-xml": "^6.1.0",
|
||||||
"@codemirror/lang-yaml": "^6.1.1",
|
"@codemirror/lang-yaml": "^6.1.1",
|
||||||
"@uiw/codemirror-theme-vscode": "^4.23.0",
|
|
||||||
"@vicons/ionicons5": "^0.12.0",
|
"@vicons/ionicons5": "^0.12.0",
|
||||||
"axios": "^1.7.3",
|
"axios": "^1.7.3",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
|
|||||||
Generated
-27
@@ -41,9 +41,6 @@ importers:
|
|||||||
'@codemirror/lang-yaml':
|
'@codemirror/lang-yaml':
|
||||||
specifier: ^6.1.1
|
specifier: ^6.1.1
|
||||||
version: 6.1.1(@codemirror/view@6.33.0)
|
version: 6.1.1(@codemirror/view@6.33.0)
|
||||||
'@uiw/codemirror-theme-vscode':
|
|
||||||
specifier: ^4.23.0
|
|
||||||
version: 4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)
|
|
||||||
'@vicons/ionicons5':
|
'@vicons/ionicons5':
|
||||||
specifier: ^0.12.0
|
specifier: ^0.12.0
|
||||||
version: 0.12.0
|
version: 0.12.0
|
||||||
@@ -496,16 +493,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-TRdIPqdsvKmPla44kVy4jv5Nt5vjMfVjbIEke1CRULIrwKNRC4lIiZvNYDJvbUMNCFPNIUcOKhXTyMJrX18IMA==}
|
resolution: {integrity: sha512-TRdIPqdsvKmPla44kVy4jv5Nt5vjMfVjbIEke1CRULIrwKNRC4lIiZvNYDJvbUMNCFPNIUcOKhXTyMJrX18IMA==}
|
||||||
deprecated: This is a stub types definition. pdfjs-dist provides its own type definitions, so you do not need this installed.
|
deprecated: This is a stub types definition. pdfjs-dist provides its own type definitions, so you do not need this installed.
|
||||||
|
|
||||||
'@uiw/codemirror-theme-vscode@4.23.0':
|
|
||||||
resolution: {integrity: sha512-zl1FD7U1b58tqlF216jYv2okvVkTe+FP1ztqO/DF129bcH99QjszkakshyfxQEvvF4ys3zyzqZ7vU3VYBir8tg==}
|
|
||||||
|
|
||||||
'@uiw/codemirror-themes@4.23.0':
|
|
||||||
resolution: {integrity: sha512-9fiji9xooZyBQozR1i6iTr56YP7j/Dr/VgsNWbqf5Szv+g+4WM1iZuiDGwNXmFMWX8gbkDzp6ASE21VCPSofWw==}
|
|
||||||
peerDependencies:
|
|
||||||
'@codemirror/language': '>=6.0.0'
|
|
||||||
'@codemirror/state': '>=6.0.0'
|
|
||||||
'@codemirror/view': '>=6.0.0'
|
|
||||||
|
|
||||||
'@vicons/ionicons5@0.12.0':
|
'@vicons/ionicons5@0.12.0':
|
||||||
resolution: {integrity: sha512-Iy1EUVRpX0WWxeu1VIReR1zsZLMc4fqpt223czR+Rpnrwu7pt46nbnC2ycO7ItI/uqDLJxnbcMC7FujKs9IfFA==}
|
resolution: {integrity: sha512-Iy1EUVRpX0WWxeu1VIReR1zsZLMc4fqpt223czR+Rpnrwu7pt46nbnC2ycO7ItI/uqDLJxnbcMC7FujKs9IfFA==}
|
||||||
|
|
||||||
@@ -1596,20 +1583,6 @@ snapshots:
|
|||||||
- encoding
|
- encoding
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@uiw/codemirror-theme-vscode@4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)':
|
|
||||||
dependencies:
|
|
||||||
'@uiw/codemirror-themes': 4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- '@codemirror/language'
|
|
||||||
- '@codemirror/state'
|
|
||||||
- '@codemirror/view'
|
|
||||||
|
|
||||||
'@uiw/codemirror-themes@4.23.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)':
|
|
||||||
dependencies:
|
|
||||||
'@codemirror/language': 6.10.2
|
|
||||||
'@codemirror/state': 6.4.1
|
|
||||||
'@codemirror/view': 6.33.0
|
|
||||||
|
|
||||||
'@vicons/ionicons5@0.12.0': {}
|
'@vicons/ionicons5@0.12.0': {}
|
||||||
|
|
||||||
'@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.4.37(typescript@5.5.4))':
|
'@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.4.37(typescript@5.5.4))':
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,18 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="codemirror-container" ref="rootRef" :class="`codemirror-container-${theme}`">
|
||||||
class="codemirror-container"
|
|
||||||
ref="rootRef"
|
|
||||||
:class="`codemirror-container-${theme}`">
|
|
||||||
<div class="codemirror-container-top">
|
<div class="codemirror-container-top">
|
||||||
<button @click="handleSave">保存</button>
|
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleSave">保存</div>
|
||||||
<button @click="switchTheme">切换主题</button>
|
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleReset">恢复到上次保存</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <NScrollbar :key="_key"> -->
|
<NScrollbar>
|
||||||
<codemirror
|
<codemirror v-model="codeData" :extensions="extensions" :style="{ height: '100%' }" />
|
||||||
v-model="codeData"
|
</NScrollbar>
|
||||||
:extensions="extensions"
|
|
||||||
:style="{ height: '100%' }" />
|
|
||||||
<!-- </NScrollbar> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -22,7 +16,6 @@ import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
|||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { Codemirror } from 'vue-codemirror'
|
import { Codemirror } from 'vue-codemirror'
|
||||||
import { NScrollbar } from 'naive-ui'
|
import { NScrollbar } from 'naive-ui'
|
||||||
import { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode'
|
|
||||||
|
|
||||||
const miaoFetchApi = useMiaoFetchApi()
|
const miaoFetchApi = useMiaoFetchApi()
|
||||||
|
|
||||||
@@ -32,7 +25,7 @@ const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
|||||||
|
|
||||||
const vFile = ref<VirtualFile>()
|
const vFile = ref<VirtualFile>()
|
||||||
const rootRef = ref<HTMLDivElement>()
|
const rootRef = ref<HTMLDivElement>()
|
||||||
const _key = ref(Math.random())
|
// const _key = ref(Math.random())
|
||||||
const codeData = ref<string>()
|
const codeData = ref<string>()
|
||||||
// 第一次点击保存时自动备份data,暂时懒得做
|
// 第一次点击保存时自动备份data,暂时懒得做
|
||||||
const bakData = ref<string>()
|
const bakData = ref<string>()
|
||||||
@@ -54,18 +47,22 @@ const handleSave = async () => {
|
|||||||
false && miaoFetchApi.upload(file_bak, parentDir)
|
false && miaoFetchApi.upload(file_bak, parentDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
const switchTheme = async () => {
|
const handleReset = async () => {
|
||||||
if (!vFile.value) {
|
codeData.value = bakData.value
|
||||||
return
|
|
||||||
}
|
|
||||||
theme.value = theme.value === 'dark' ? 'light' : 'dark'
|
|
||||||
extensions.value = [
|
|
||||||
...(await getLangExtensions(vFile.value?.name)),
|
|
||||||
theme.value === 'dark' ? vscodeDark : vscodeLight
|
|
||||||
]
|
|
||||||
_key.value = Math.random()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const switchTheme = async () => {
|
||||||
|
// if (!vFile.value) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// theme.value = theme.value === 'dark' ? 'light' : 'dark'
|
||||||
|
// extensions.value = [
|
||||||
|
// ...(await getLangExtensions(vFile.value?.name)),
|
||||||
|
// // theme.value === 'dark' ?
|
||||||
|
// ]
|
||||||
|
// _key.value = Math.random()
|
||||||
|
// }
|
||||||
|
|
||||||
const getLangExtensions = async (fileName: string) => {
|
const getLangExtensions = async (fileName: string) => {
|
||||||
const ext = fileName.split('.').pop()?.toLocaleLowerCase()
|
const ext = fileName.split('.').pop()?.toLocaleLowerCase()
|
||||||
switch (ext) {
|
switch (ext) {
|
||||||
@@ -74,7 +71,7 @@ const getLangExtensions = async (fileName: string) => {
|
|||||||
case 'ts':
|
case 'ts':
|
||||||
case 'tsx':
|
case 'tsx':
|
||||||
const { javascript } = await import('@codemirror/lang-javascript')
|
const { javascript } = await import('@codemirror/lang-javascript')
|
||||||
return [javascript()]
|
return [javascript({ jsx: ext.substring(2, 3) === 'x', typescript: ext.substring(0, 2) === 'js', })]
|
||||||
break
|
break
|
||||||
case 'css':
|
case 'css':
|
||||||
case 'scss':
|
case 'scss':
|
||||||
@@ -127,7 +124,7 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
).toString()
|
).toString()
|
||||||
bakData.value = codeData.value
|
bakData.value = codeData.value
|
||||||
extensions.value = [...(await getLangExtensions(fileName)), vscodeLight]
|
extensions.value = [...(await getLangExtensions(fileName))]
|
||||||
|
|
||||||
rootRef.value?.addEventListener('keydown', (event) => {
|
rootRef.value?.addEventListener('keydown', (event) => {
|
||||||
if (event.ctrlKey && event.key === 's') {
|
if (event.ctrlKey && event.key === 's') {
|
||||||
@@ -142,13 +139,33 @@ onMounted(async () => {
|
|||||||
.codemirror-container {
|
.codemirror-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
&-top {
|
|
||||||
background-color: aqua;
|
.codemirror-container-top {
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.codemirror-container-btn {
|
||||||
|
height: 25px;
|
||||||
|
padding: 0 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
background-color: none;
|
||||||
|
transition: background-color 0.25s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #e8e8e8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.codemirror-container-dark {
|
.codemirror-container-dark {
|
||||||
background-color: rgb(30, 30, 30);
|
background-color: rgb(30, 30, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
.codemirror-container-light {
|
.codemirror-container-light {
|
||||||
background-color: rgb(255, 255, 255);
|
background-color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ const { setVideo } = (() => {
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
volume: 1,
|
volume: 1,
|
||||||
fluid: true,
|
|
||||||
pip: true,
|
pip: true,
|
||||||
videoFillMode: 'contain',
|
videoFillMode: 'contain',
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
|
|||||||
+6
-5
@@ -64,11 +64,12 @@ export default defineConfig({
|
|||||||
output: {
|
output: {
|
||||||
// 配置输出为单文件
|
// 配置输出为单文件
|
||||||
// inlineDynamicImports: true,
|
// inlineDynamicImports: true,
|
||||||
manualChunks(id) {
|
// manualChunks(id) {
|
||||||
if (id.includes('@codemirror')) {
|
// 加了会有bug
|
||||||
return id.split('@')[1].replace('+', '-')
|
// if (id.includes('@codemirror')) {
|
||||||
}
|
// return id.split('@')[1].replace('+', '-')
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
// entryFileNames: 'bundle.js',
|
// entryFileNames: 'bundle.js',
|
||||||
// format: 'iife', // 立即执行函数格式
|
// format: 'iife', // 立即执行函数格式
|
||||||
// name: 'MyBundle'
|
// name: 'MyBundle'
|
||||||
|
|||||||
Reference in new issue
Block a user