From de2e53cbcfef9609c909e539857b22a608cecd63 Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Sat, 31 Aug 2024 14:18:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=8F=92=E4=BB=B6=E5=8F=AF=E7=94=A8=E6=80=A7=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=822.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86code=E6=8F=92=E4=BB=B6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/miaoMessageProvider.vue | 7 +++++++ src/hooks/init.ts | 11 +++++++---- src/views/miaoCodeMirror.vue | 15 ++++++++++++--- src/views/miaoImages.vue | 11 +++++++---- 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 src/components/miaoMessageProvider.vue diff --git a/src/components/miaoMessageProvider.vue b/src/components/miaoMessageProvider.vue new file mode 100644 index 0000000..4ea00a7 --- /dev/null +++ b/src/components/miaoMessageProvider.vue @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/hooks/init.ts b/src/hooks/init.ts index 8364c27..9c07cb3 100644 --- a/src/hooks/init.ts +++ b/src/hooks/init.ts @@ -106,13 +106,16 @@ export default function init() { if (vDirs.length === 0 && vFiles.length === 0) { return false; } - miao: for (let vf of vFiles) - for (let end of [".xbm", ".tif", "pjp", ".svgz", "jpg", "jpeg", "ico", "tiff", ".gif", "svg", ".jfif", ".webp", ".png", ".bmp", "pjpeg", ".avif"]) { + if( vDirs.length ) { + return true + } + for (let vf of vFiles) + for (let end of ["xbm", "tif", "pjp", "svgz", "jpg", "jpeg", "ico", "tiff", "gif", "svg", "jfif", "webp", "png", ".bmp", "pjpeg", "avif"]) { if (vf.name.endsWith(end)) { - continue miao; + return true } } - return true; + return false; } ); } diff --git a/src/views/miaoCodeMirror.vue b/src/views/miaoCodeMirror.vue index 89c3b0a..51ceb96 100644 --- a/src/views/miaoCodeMirror.vue +++ b/src/views/miaoCodeMirror.vue @@ -4,9 +4,11 @@
保存
恢复到上次保存
- - - +
+ + + +
@@ -139,8 +141,10 @@ onMounted(async () => { .codemirror-container { width: 100%; height: 100%; + overflow-y: hidden; .codemirror-container-top { + height: 25px; display: flex; border-bottom: 1px solid #000; } @@ -160,6 +164,11 @@ onMounted(async () => { background-color: #e8e8e8; } } + + .codemirror-container-main { + height: calc( 100% - 25px ); + position: relative; + } } .codemirror-container-dark { diff --git a/src/views/miaoImages.vue b/src/views/miaoImages.vue index bb6fe45..37817f9 100644 --- a/src/views/miaoImages.vue +++ b/src/views/miaoImages.vue @@ -98,14 +98,17 @@ const handleDrop = (vItems: (VirtualFile | VirtualDirectory)[]) => { } const updateImageSrcList = async (source: VirtualFile | VirtualDirectory) => { - let srcList: string[] + let newSrcList: string[] if (source.type === 'directory') { await source.update() - srcList = source.files?.filter(v => imageSuffixList.includes(v.name.split('.').pop() ?? '')).map(v => v.url) ?? [] + newSrcList = source.files?.filter(v => imageSuffixList.includes(v.name.split('.').pop() ?? '')).map(v => v.url) ?? [] } else { - srcList = [source.url] + if (!imageSuffixList.includes(source.name.split('.').pop() ?? '')) { + return + } + newSrcList = [source.url] } - imageSrcList.value = uniq([...imageSrcList.value, ...srcList]) + imageSrcList.value = uniq([...imageSrcList.value, ...newSrcList]) } onMounted(() => {