优化:CSV编辑模式/PDF导出重构/收藏夹bug修复/移除useLocalStorage
- FileEditorPanel: CSV新增预览/编辑切换、PDF导出;提取openPrintWindow公共函数 - useFavorites: 修复find回调中fav变量遮蔽bug(f.path)、sort改为副本排序 - useFavoriteFiles/DeviceTest: 移除useLocalStorage抽象层,直接管理localStorage - system.ts: createDir/createFile签名改为(parent, name)两参数拼接 - useFileOperations: createNewFile移除无用content参数 - 清理OpenClaw相关Wails绑定
This commit is contained in:
@@ -24,7 +24,7 @@ export function useFavorites() {
|
||||
* 排序收藏列表:置顶项在前(按 pinnedAt 降序),非置顶项按添加时间降序
|
||||
*/
|
||||
const sortFavorites = () => {
|
||||
favorites.value.sort((a, b) => {
|
||||
favorites.value = [...favorites.value].sort((a, b) => {
|
||||
// 置顶项优先
|
||||
if (a.pinnedAt && !b.pinnedAt) return -1
|
||||
if (!a.pinnedAt && b.pinnedAt) return 1
|
||||
@@ -135,7 +135,7 @@ export function useFavorites() {
|
||||
*/
|
||||
const togglePin = (path: string) => {
|
||||
const normalizedPath = normalizePath(path)
|
||||
const fav = favorites.value.find(f => normalizePath(fav.path) === normalizedPath)
|
||||
const fav = favorites.value.find(f => normalizePath(f.path) === normalizedPath)
|
||||
if (fav) {
|
||||
fav.pinnedAt = fav.pinnedAt ? undefined : Date.now()
|
||||
sortFavorites()
|
||||
@@ -148,7 +148,7 @@ export function useFavorites() {
|
||||
*/
|
||||
const isPinned = (path: string): boolean => {
|
||||
const normalizedPath = normalizePath(path)
|
||||
const fav = favorites.value.find(f => normalizePath(fav.path) === normalizedPath)
|
||||
const fav = favorites.value.find(f => normalizePath(f.path) === normalizedPath)
|
||||
return !!fav?.pinnedAt
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ export function useFavorites() {
|
||||
*/
|
||||
const updateFavoritePath = (oldPath: string, newName: string) => {
|
||||
const normalizedOld = normalizePath(oldPath)
|
||||
const fav = favorites.value.find(f => normalizePath(fav.path) === normalizedOld)
|
||||
const fav = favorites.value.find(f => normalizePath(f.path) === normalizedOld)
|
||||
if (!fav) return
|
||||
|
||||
const separator = getPathSeparator(oldPath)
|
||||
|
||||
Reference in New Issue
Block a user