From 7467f38f65e4b05dacc389644a8001b24f86fcdb Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sun, 8 Sep 2024 07:43:07 +0800 Subject: [PATCH] fix: cancel creating new file (#281) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- src/editor/FileSelector.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/editor/FileSelector.vue b/src/editor/FileSelector.vue index 2946cae2..6c81bf7d 100644 --- a/src/editor/FileSelector.vue +++ b/src/editor/FileSelector.vue @@ -58,6 +58,11 @@ function focus({ el }: VNode) { function doneNameFile() { if (!pending.value) return + if (!pendingFilename.value) { + pending.value = false + return + } + // add back the src prefix const filename = 'src/' + pendingFilename.value const oldFilename = pending.value === true ? '' : pending.value