fix(tree): resolve file drop targets to their containing folders

This commit is contained in:
eezd committed 2026-10-24 18:12:36 +08:00
1 parent 08f4e4aa7d
commit 634ef9fc11
4 files changed
+176 -20

No files matched your search

+4 -1
View File
@@ -1,4 +1,4 @@
import { computed, reactive, watch } from 'vue'
import { computed, reactive, ref, watch } from 'vue'
import type { Entry } from './api'
import { basename, dirname, hiddenAssetPath } from './paths'
import { rangePaths } from './selection'
@@ -32,6 +32,9 @@ function build(entries: Entry[]): TreeNode[] {
export const tree = computed(() => build(ws.entries.filter((entry) => !hiddenAssetPath(entry.path))))
// null 表示无接收目标,空字符串表示根目录;文件行指向它的直接父目录。
export const dropDirectory = ref<string | null>(null)
const EXPANDED_KEY = 'rawmark.expanded'
export const expanded = reactive(new Set<string>(JSON.parse(localStorage.getItem(EXPANDED_KEY) ?? '[]') as string[]))
watch(expanded, () => localStorage.setItem(EXPANDED_KEY, JSON.stringify([...expanded])))