diff --git a/packages/web/package.json b/packages/web/package.json index c1311fcd..93daa62c 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -17,6 +17,7 @@ "@memoh/sdk": "workspace:*", "@memoh/ui": "workspace:*", "@pinia/colada": "^0.21.1", + "@shikijs/transformers": "^4.0.1", "@tailwindcss/vite": "^4.1.18", "@tanstack/vue-table": "^8.21.3", "@vee-validate/zod": "^4.15.1", diff --git a/packages/web/src/components/file-manager/index.vue b/packages/web/src/components/file-manager/index.vue index bdfa127b..1a94e20e 100644 --- a/packages/web/src/components/file-manager/index.vue +++ b/packages/web/src/components/file-manager/index.vue @@ -253,6 +253,22 @@ watch(() => props.botId, () => { onMounted(() => { restoreFileFromUrl() }) + +function navigateTo(dirPath: string) { + openFile.value = null + syncFileToUrl(null) + void loadDirectory(dirPath) +} + +function openFileByPath(filePath: string) { + const name = filePath.split('/').pop() ?? '' + const dir = filePath.substring(0, filePath.lastIndexOf('/')) || '/' + openFile.value = { path: filePath, name, isDir: false } + syncFileToUrl(filePath) + void loadDirectory(dir) +} + +defineExpose({ navigateTo, openFileByPath })