Skip to content

Commit d29d1de

Browse files
committed
fix: strip src prefix on dialog
1 parent 05ba401 commit d29d1de

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Diff for: src/editor/FileSelector.vue

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { Store, importMapFile, tsconfigFile } from '../store'
2+
import { Store, importMapFile, tsconfigFile, stripSrcPrefix } from '../store'
33
import { computed, inject, ref, VNode, Ref } from 'vue'
44
55
const store = inject('store') as Store
@@ -93,10 +93,6 @@ function editFileName(file: string) {
9393
pending.value = file
9494
}
9595
96-
function stripSrcPrefix(file: string) {
97-
return file.replace(/^src\//, '')
98-
}
99-
10096
const fileSel = ref(null)
10197
function horizontalScroll(e: WheelEvent) {
10298
e.preventDefault()

Diff for: src/output/srcdoc.html

-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
}
194194
}
195195
)
196-
197196
;[
198197
{ method: 'group', action: 'console_group' },
199198
{ method: 'groupEnd', action: 'console_group_end' },

Diff for: src/store.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ export class ReplStore implements Store {
231231
}
232232

233233
deleteFile(filename: string) {
234-
if (confirm(`Are you sure you want to delete ${filename}?`)) {
234+
if (
235+
confirm(`Are you sure you want to delete ${stripSrcPrefix(filename)}?`)
236+
) {
235237
if (this.state.activeFile.filename === filename) {
236238
this.state.activeFile = this.state.files[this.state.mainFile]
237239
}
@@ -435,3 +437,7 @@ function setFile(
435437
function fixURL(url: string) {
436438
return url.replace('https://sfc.vuejs', 'https://play.vuejs')
437439
}
440+
441+
export function stripSrcPrefix(file: string) {
442+
return file.replace(/^src\//, '')
443+
}

Diff for: vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const genStub: Plugin = {
1515

1616
export default defineConfig({
1717
...base,
18-
plugins: [...(base as UserConfig).plugins! , genStub],
18+
plugins: [...(base as UserConfig).plugins!, genStub],
1919
optimizeDeps: {
2020
// avoid late discovered deps
2121
include: [

0 commit comments

Comments
 (0)