diff --git a/CHANGELOG.md b/CHANGELOG.md index 99ca1c9..a8a04e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # 更新日志 +## 2026-11-18 → v1.4.6 + +- ✨ **文件夹右键新增「批量重命名文件」**:三种模式 —— 前面加(前缀)、后面加(后缀)、全部改名(原文件名整体替换,扩展名始终保留) +- ✨ 支持**包含子目录**开关,递归处理所有层级文件(默认开启,可只改当前文件夹) +- ✨ 弹窗**实时预览**改名效果(输入文本后即时显示每个文件的新旧文件名对照与总数) +- 🛡️ 全部改名模式同目录多个文件**自动编号**(文本-001、文本-002…,每个子目录独立编号;单文件不编号),避免撞名 +- 🛡️ 冲突保护:目标文件名已存在(含本次内重复)自动跳过并在结果中报告;文本含文件名非法字符 `\ / : * ? " < > |` 前后端双重校验 +- ⚡️ 复用批量水印异步任务体系:进度条、可停止(已完成的保留)、完成统计(已重命名/已跳过/失败 + 失败明细) +- 🔒 重命名后同步更新数据库记录(path/filename);缩略图按内容 hash 存储、与文件名无关,无需重建;旧路径零残留 +- 后端新增 `POST /api/batch/rename-preview` 预览接口;`POST /api/batch/start` 的 type 扩展 `rename` +- 端到端实测:preview 三模式(含子目录/不含子目录/自动编号)、非法字符 400、suffix/prefix 实际执行 FS+DB 一致、浏览器 UI 右键菜单→弹窗→预览→执行→完成全流程 + ## 2026-11-18 → v1.4.5 **优化:侧栏文件夹按日期倒序,最新的文件夹排最前**——原先侧栏/仪表盘文件夹顺序来自后端 `SELECT ... ORDER BY path`(名称字典序升序),最旧的文件夹排最前,最新日期沉底。现改为在 `FolderModel.getTree()` 按文件夹名解析出的真实日期倒序排序: diff --git a/backend/src/routes/batch.js b/backend/src/routes/batch.js index 29b5ff3..422d0af 100644 --- a/backend/src/routes/batch.js +++ b/backend/src/routes/batch.js @@ -1,6 +1,7 @@ /** - * 文件夹批量水印路由 - * - POST /api/batch/start 启动批量任务(加水印 / 去水印),返回 taskId 立即返回 + * 文件夹批量水印/重命名路由 + * - POST /api/batch/start 启动批量任务(加水印 / 去水印 / 重命名),返回 taskId 立即返回 + * - POST /api/batch/rename-preview 批量重命名预览(不执行) * - GET /api/batch/status/:id 查询任务进度 * - POST /api/batch/cancel/:id 取消任务 * @@ -312,8 +313,163 @@ async function runRemoveWatermark(req, task) { }); } +// ---------- 批量重命名 ---------- + +/** 文件系统非法文件名字符(Windows 兼容) */ +const ILLEGAL_NAME_RE = /[\\/:*?"<>|]/; + +/** + * 计算重命名计划(preview 与执行共用,保证一致) + * @param {object} opts { images, folder, mode: 'prefix'|'suffix'|'replace', text, includeSubdirs } + * @returns {Array<{img, newFilename, newPath, absNew, skipReason?}>} + */ +function computeRenamePlan({ images, folder, mode, text, includeSubdirs }) { + const cleanText = String(text || '').trim(); + let list = images; + if (!includeSubdirs) { + // 只重命名该文件夹直接子项,排除子目录内文件 + list = images.filter((img) => img.folder === folder); + } + // 按目录分组 + 原文件名升序,保证序号顺序稳定 + const sorted = [...list].sort( + (a, b) => a.folder.localeCompare(b.folder) || a.filename.localeCompare(b.filename) + ); + + const dirGroups = new Map(); + for (const img of sorted) { + if (!dirGroups.has(img.folder)) dirGroups.set(img.folder, []); + dirGroups.get(img.folder).push(img); + } + + const used = new Set(); // 已分配的目标路径(小写归一,防大小写不敏感 FS 撞名) + const plan = []; + for (const [, group] of dirGroups) { + const width = Math.max(3, String(group.length).length); + for (let i = 0; i < group.length; i++) { + const img = group[i]; + const ext = path.extname(img.filename); // 含点,保留原样 + const base = img.filename.slice(0, img.filename.length - ext.length); + let newBase; + if (mode === 'prefix') newBase = cleanText + base; + else if (mode === 'suffix') newBase = base + cleanText; + else if (mode === 'replace') { + // 全部改名:整段替换原文件名,同目录多个文件自动编号避免撞名 + newBase = group.length > 1 + ? `${cleanText}-${String(i + 1).padStart(width, '0')}` + : cleanText; + } else newBase = base; + + const newFilename = `${newBase}${ext}`; + const newPath = `${img.folder ? img.folder + '/' : ''}${newFilename}`; + const absNew = newPath; // 相对库根,执行时再 join + + const entry = { img, newFilename, newPath, skipReason: null }; + if (newFilename === img.filename) { + entry.skipReason = '文件名未变化'; + } else if (used.has(newPath.toLowerCase())) { + entry.skipReason = '目标文件名冲突(本次内)'; + } + used.add(newPath.toLowerCase()); + plan.push(entry); + } + } + return plan; +} + +async function runRename(req, task) { + const { library, images } = collectImages(req, task.payload.libraryId, task.payload.folder); + const opts = task.payload.options; + + const plan = computeRenamePlan({ + images, + folder: task.payload.folder, + mode: opts.mode, + text: opts.text, + includeSubdirs: opts.includeSubdirs !== false + }); + task.total = plan.length; + + const dbPool = req.app.get('dbPool'); + const dbUpdates = []; + + for (const entry of plan) { + if (task.cancelled) break; + const { img, newFilename, newPath, skipReason } = entry; + task.current = img.path; + if (skipReason) { + task.skipped++; + continue; + } + const absOld = path.join(library.path, img.path); + const absNew = path.join(library.path, newPath); + try { + if (!fs.existsSync(absOld)) { + task.skipped++; + if (task.errors.length < 20) task.errors.push({ path: img.path, error: '源文件不存在' }); + continue; + } + if (absOld !== absNew && fs.existsSync(absNew)) { + task.skipped++; + if (task.errors.length < 20) task.errors.push({ path: img.path, error: `目标已存在: ${newFilename}` }); + continue; + } + if (absOld !== absNew) await fs.promises.rename(absOld, absNew); + dbUpdates.push({ oldPath: img.path, newPath, newFilename }); + task.done++; + } catch (err) { + task.failed++; + if (task.errors.length < 20) task.errors.push({ path: img.path, error: err.message }); + logger.warn(`⚠️ 批量重命名失败 ${img.path}: ${err.message}`); + } + } + + // 统一更新 DB(缩略图按内容 hash 存储,与文件名无关,无需重建) + if (dbUpdates.length > 0) { + const db = dbPool.acquire(library.path); + try { + const stmt = db.db.prepare('UPDATE images SET path = ?, filename = ? WHERE path = ?'); + for (const u of dbUpdates) stmt.run(u.newPath, u.newFilename, u.oldPath); + } finally { + dbPool.release(library.path); + } + } +} + // ---------- 路由 ---------- +/** + * POST /api/batch/rename-preview + * body: { libraryId, folder, options: { mode, text, includeSubdirs } } + * 返回重命名预览(不执行) + */ +router.post( + '/rename-preview', + asyncHandler(async (req, res) => { + const { libraryId, folder, options } = req.body || {}; + if (!libraryId || !folder) throw new ValidationError('缺少 libraryId 或 folder'); + const mode = options && options.mode; + if (!['prefix', 'suffix', 'replace'].includes(mode)) { + throw new ValidationError('mode 必须是 prefix / suffix / replace'); + } + const text = String((options && options.text) || '').trim(); + if (!text) throw new ValidationError('重命名文本不能为空'); + if (ILLEGAL_NAME_RE.test(text)) throw new ValidationError('文本包含文件名非法字符 \\ / : * ? " < > |'); + + const { images } = collectImages(req, libraryId, folder); + const plan = computeRenamePlan({ + images, folder, mode, text, + includeSubdirs: options.includeSubdirs !== false + }); + const effective = plan.filter((p) => !p.skipReason); + res.json({ + count: effective.length, + total: plan.length, + samples: plan.slice(0, 6).map((p) => ({ from: p.img.filename, to: p.newFilename })), + skipped: plan.filter((p) => p.skipReason).length + }); + }) +); + /** * POST /api/batch/start * body: { libraryId, folder, type: 'add'|'remove', output?: 'overwrite'|'new', options } @@ -325,10 +481,19 @@ router.post( asyncHandler(async (req, res) => { const { libraryId, folder, type, output, options } = req.body || {}; if (!libraryId || !folder) throw new ValidationError('缺少 libraryId 或 folder'); - if (type !== 'add' && type !== 'remove') throw new ValidationError('type 必须是 add 或 remove'); + if (!['add', 'remove', 'rename'].includes(type)) throw new ValidationError('type 必须是 add / remove / rename'); if (type === 'add') { if (!options || !String(options.text || '').trim()) throw new ValidationError('水印文字不能为空'); + } else if (type === 'rename') { + const mode = options && options.mode; + if (!['prefix', 'suffix', 'replace'].includes(mode)) { + throw new ValidationError('mode 必须是 prefix / suffix / replace'); + } + if (!String(options.text || '').trim()) throw new ValidationError('重命名文本不能为空'); + if (ILLEGAL_NAME_RE.test(String(options.text).trim())) { + throw new ValidationError('文本包含文件名非法字符 \\ / : * ? " < > |'); + } } else { const r = options && options.region; if (!r || [r.x, r.y, r.w, r.h].some((v) => typeof v !== 'number' || v < 0)) { @@ -338,14 +503,14 @@ router.post( } const { images } = collectImages(req, libraryId, folder); - if (images.length === 0) throw new ValidationError('该文件夹下没有图片'); + if (images.length === 0) throw new ValidationError(type === 'rename' ? '该文件夹下没有文件' : '该文件夹下没有图片'); const task = newTask(type, { libraryId, folder, output, options }); task.total = images.length; - logger.info(`▶️ 批量${type === 'add' ? '加水印' : '去水印'}启动: ${folder} (${images.length} 张)`); + logger.info(`▶️ 批量${type === 'add' ? '加水印' : type === 'remove' ? '去水印' : '重命名'}启动: ${folder} (${images.length} 张)`); // 立即返回,后台执行 - const runner = type === 'add' ? runAddWatermark : runRemoveWatermark; + const runner = type === 'add' ? runAddWatermark : type === 'remove' ? runRemoveWatermark : runRename; runner(req, task) .then(() => { task.status = task.cancelled ? 'cancelled' : 'done'; diff --git a/backend/utils/hub.js b/backend/utils/hub.js index d2cd38a..7bdf79e 100644 --- a/backend/utils/hub.js +++ b/backend/utils/hub.js @@ -16,7 +16,7 @@ const { getSettings } = require('./settings'); const HUB_URL = (process.env.HUB_URL || 'https://auth.88531.cn/api').replace(/\/+$/, ''); const HUB_PROJECT_ID = process.env.HUB_PROJECT_ID || ''; const HUB_API_KEY = process.env.HUB_API_KEY || ''; -const SITE_VERSION = process.env.SITE_VERSION || '1.4.5'; +const SITE_VERSION = process.env.SITE_VERSION || '1.4.6'; const TIMEOUT_MS = 8000; const state = { diff --git a/docker-compose.yml b/docker-compose.yml index 4db3627..dd5a941 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: - HUB_API_KEY=${HUB_API_KEY:-} - NEWAPI_KEY=${NEWAPI_KEY:-} # 当前站点版本(与 frontend/package.json、CHANGELOG 保持一致,界面版本徽标来源) - - SITE_VERSION=1.4.5 + - SITE_VERSION=1.4.6 # 让容器经 host.docker.internal 访问宿主机的 AI 侧车 extra_hosts: - "host.docker.internal:host-gateway" diff --git a/frontend/src/api/endpoints/batch.js b/frontend/src/api/endpoints/batch.js index 4dd22a0..d8f3842 100644 --- a/frontend/src/api/endpoints/batch.js +++ b/frontend/src/api/endpoints/batch.js @@ -19,3 +19,9 @@ export async function status(taskId) { export async function cancel(taskId) { return api.post(`/batch/cancel/${taskId}`); } + +/** 批量重命名预览(不执行),返回 { count, total, samples: [{from,to}], skipped } */ +export async function renamePreview(payload) { + // payload: { libraryId, folder, options: { mode, text, includeSubdirs } } + return api.post('/batch/rename-preview', payload); +} diff --git a/frontend/src/components/BatchRenameModal.jsx b/frontend/src/components/BatchRenameModal.jsx new file mode 100644 index 0000000..2332de6 --- /dev/null +++ b/frontend/src/components/BatchRenameModal.jsx @@ -0,0 +1,379 @@ +import { useState, useEffect, useRef, useCallback } from 'react'; +import { Replace, Loader2, X, Play, Square, CheckCircle2, AlertTriangle, ArrowRight } from 'lucide-react'; +import { batchAPI } from '../api'; + +/** + * 批量重命名弹窗(文件夹级) + * 模式: + * prefix 前缀添加 —— 在原文件名前加文本 + * suffix 后缀添加 —— 在原文件名后加文本 + * replace 全部改名 —— 原文件名整体替换为文本(同目录多个文件自动加序号 -001) + * + * 流程:配置(实时预览)→ 启动任务(立即返回 taskId)→ 1s 轮询进度 → 完成/取消 + */ + +const MODES = [ + { key: 'prefix', label: '前面加', desc: '在原文件名前加文本', hint: '文本 + 原文件名 + 扩展名' }, + { key: 'suffix', label: '后面加', desc: '在原文件名后加文本', hint: '原文件名 + 文本 + 扩展名' }, + { key: 'replace', label: '全部改名', desc: '原文件名替换为文本', hint: '同目录多个文件自动编号:文本-001、文本-002…' } +]; + +const ILLEGAL_RE = /[\\/:*?"<>|]/; + +function BatchRenameModal({ isOpen, folder, libraryId, onClose, onFinished }) { + const [phase, setPhase] = useState('config'); // config | running | done + const [mode, setMode] = useState('prefix'); + const [text, setText] = useState(''); + const [includeSubdirs, setIncludeSubdirs] = useState(true); + const [preview, setPreview] = useState(null); // { count, total, samples, skipped } + const [previewErr, setPreviewErr] = useState(''); + const [starting, setStarting] = useState(false); + const [error, setError] = useState(''); + + const [taskId, setTaskId] = useState(null); + const [progress, setProgress] = useState(null); + const pollRef = useRef(null); + const previewTimerRef = useRef(null); + + const stopPolling = useCallback(() => { + if (pollRef.current) { + clearInterval(pollRef.current); + pollRef.current = null; + } + }, []); + + // 打开时重置 + useEffect(() => { + if (!isOpen) return; + setPhase('config'); + setMode('prefix'); + setText(''); + setIncludeSubdirs(true); + setPreview(null); + setPreviewErr(''); + setError(''); + setTaskId(null); + setProgress(null); + setStarting(false); + return () => stopPolling(); + }, [isOpen, stopPolling]); + + // 实时预览(防抖 300ms) + useEffect(() => { + if (!isOpen || phase !== 'config') return; + if (previewTimerRef.current) clearTimeout(previewTimerRef.current); + const t = text.trim(); + if (!t) { + setPreview(null); + setPreviewErr(''); + return; + } + previewTimerRef.current = setTimeout(async () => { + try { + const resp = await batchAPI.renamePreview({ + libraryId, folder, + options: { mode, text: t, includeSubdirs } + }); + setPreview(resp); + setPreviewErr(''); + } catch (err) { + setPreview(null); + setPreviewErr(err?.message || '预览失败'); + } + }, 300); + return () => { if (previewTimerRef.current) clearTimeout(previewTimerRef.current); }; + }, [isOpen, phase, mode, text, includeSubdirs, libraryId, folder]); + + const startPolling = useCallback((id) => { + stopPolling(); + pollRef.current = setInterval(async () => { + try { + const s = await batchAPI.status(id); + setProgress(s); + if (s.status !== 'running') { + stopPolling(); + setPhase('done'); + onFinished?.(s); + } + } catch (_) { /* 网络抖动,继续轮询 */ } + }, 1000); + }, [stopPolling, onFinished]); + + const handleStart = async () => { + setError(''); + const t = text.trim(); + if (!t) { + setError('请输入重命名文本'); + return; + } + if (ILLEGAL_RE.test(t)) { + setError('文本包含文件名非法字符 \\ / : * ? " < > |'); + return; + } + setStarting(true); + try { + const resp = await batchAPI.start({ + libraryId, folder, type: 'rename', + options: { mode, text: t, includeSubdirs } + }); + setTaskId(resp.taskId); + setPhase('running'); + setProgress({ + status: 'running', total: resp.total, done: 0, failed: 0, + skipped: 0, current: '', errors: [] + }); + startPolling(resp.taskId); + } catch (err) { + setError(err?.message || '启动失败'); + } finally { + setStarting(false); + } + }; + + const handleCancel = async () => { + if (!taskId) return; + try { await batchAPI.cancel(taskId); } catch (_) { /* 已结束 */ } + stopPolling(); + setPhase('done'); + }; + + const handleClose = () => { + stopPolling(); + onClose(); + }; + + if (!isOpen) return null; + + const pct = progress && progress.total > 0 + ? Math.round(((progress.done + progress.failed + progress.skipped) / progress.total) * 100) + : 0; + const modeInfo = MODES.find((m) => m.key === mode); + + return ( +
+
e.stopPropagation()} + > + {/* 头部 */} +
+
+ +

批量重命名文件

+ + {folder} + +
+ +
+ + {/* 内容 */} +
+ {phase === 'config' && ( + <> + {/* 重命名模式 */} +
+
重命名方式
+
+ {MODES.map((m) => ( + + ))} +
+
+ 规则:{modeInfo.hint}(扩展名始终保留) +
+
+ + {/* 文本输入 */} +
+
文本内容
+ setText(e.target.value)} + placeholder={mode === 'replace' ? '例如:风景素材(全部文件改为 风景素材-001.jpg …)' : '例如:2026_'} + maxLength={100} + autoFocus + className="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm focus:outline-none focus:ring-2 focus:ring-violet-500" + /> + {ILLEGAL_RE.test(text) && ( +
包含文件名非法字符 \ / : * ? " < > |
+ )} +
+ + {/* 包含子目录 */} + + + {/* 实时预览 */} +
+
预览
+ {!text.trim() && ( +
输入文本后显示改名效果
+ )} + {text.trim() && previewErr && ( +
{previewErr}
+ )} + {text.trim() && !previewErr && !preview && ( +
+ 计算中… +
+ )} + {preview && ( + <> +
+ 将重命名 {preview.count} 个文件 + {preview.skipped > 0 && ({preview.skipped} 个跳过)} + {!includeSubdirs && ,仅当前文件夹} +
+
+ {preview.samples.map((s, i) => ( +
+ {s.from} + + {s.to} +
+ ))} + {preview.total > preview.samples.length && ( +
+ …共 {preview.total} 条 +
+ )} +
+ + )} +
+ + {error && ( +
+ {error} +
+ )} + + )} + + {phase === 'running' && ( +
+
+ + + 重命名中 {progress ? `${progress.done + progress.failed + progress.skipped}/${progress.total}` : ''} + + {pct}% +
+
+
+
+ {progress?.current && ( +
{progress.current}
+ )} +
+ +
+
+ )} + + {phase === 'done' && ( +
+
+ + + {progress?.status === 'cancelled' ? '已停止' : '重命名完成'} + +
+
+
+
{progress?.done ?? 0}
+
已重命名
+
+
+
{progress?.skipped ?? 0}
+
已跳过
+
+
+
{progress?.failed ?? 0}
+
失败
+
+
+ {progress?.errors?.length > 0 && ( +
+
失败明细
+
+ {progress.errors.slice(0, 8).map((e, i) => ( +
+ {e.path}: {e.error} +
+ ))} +
+
+ )} +
+ )} +
+ + {/* 底部按钮 */} +
+ {phase === 'config' && ( + <> + + + + )} + {phase === 'running' && ( + + )} + {phase === 'done' && ( + + )} +
+
+
+ ); +} + +export default BatchRenameModal; diff --git a/frontend/src/components/ContextMenu.jsx b/frontend/src/components/ContextMenu.jsx index d043087..9f46432 100644 --- a/frontend/src/components/ContextMenu.jsx +++ b/frontend/src/components/ContextMenu.jsx @@ -4,7 +4,7 @@ */ import { useEffect, useRef } from 'react'; -import { Trash2, Edit3, Move, Copy, FolderPlus, Star, Droplets, Eraser, Scissors, Film } from 'lucide-react'; +import { Trash2, Edit3, Move, Copy, FolderPlus, Star, Droplets, Eraser, Scissors, Film, Replace } from 'lucide-react'; function ContextMenu({ isOpen, position, onClose, options }) { const menuRef = useRef(null); @@ -173,6 +173,11 @@ export const menuItems = { label: '批量加水印…', action }), + batchRename: (action) => ({ + icon: , + label: '批量重命名文件…', + action + }), batchRemoveWatermark: (action) => ({ icon: , label: '批量去水印…', diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index dae2ae8..8445bf5 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -38,7 +38,7 @@ function Header() { // 授权系统 hub:版本 / 公告 / 在线人数 const hub = useHub(); const announcements = hub.announcements || []; - const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.5'; + const appVersion = hub.version ? `v${String(hub.version).replace(/^v/, '')}` : 'v1.4.6'; // 从全局 store 获取筛选状态 const selectedFormats = filters.formats || []; diff --git a/frontend/src/components/SettingsModal.jsx b/frontend/src/components/SettingsModal.jsx index fe233c8..30aa2eb 100644 --- a/frontend/src/components/SettingsModal.jsx +++ b/frontend/src/components/SettingsModal.jsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; import { X, ScanText, Info, Save, FlaskConical, Github, ExternalLink, Wand2 } from 'lucide-react'; import { settingsAPI } from '../api'; -const APP_VERSION = 'v1.4.5'; +const APP_VERSION = 'v1.4.6'; const REPO_URL = 'https://gitea.88531.cn/jinghui/flypic'; /** diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx index 05fdc45..1afaaf1 100644 --- a/frontend/src/components/Sidebar.jsx +++ b/frontend/src/components/Sidebar.jsx @@ -12,6 +12,7 @@ import UndoToast from './UndoToast'; import FolderSelector from './FolderSelector'; import ConflictDialog from './ConflictDialog'; import BatchWatermarkModal from './BatchWatermarkModal'; +import BatchRenameModal from './BatchRenameModal'; import { createLogger } from '../utils/logger'; const logger = createLogger('Sidebar'); @@ -54,6 +55,7 @@ function Sidebar() { const [contextMenu, setContextMenu] = useState({ isOpen: false, position: null, folder: null }); // 批量水印弹窗 { mode: 'add'|'remove', folder } const [batchWatermark, setBatchWatermark] = useState(null); + const [batchRename, setBatchRename] = useState(null); const [undoToast, setUndoToast] = useState({ isVisible: false, message: '', count: 0 }); const [undoHistory, setUndoHistory] = useState([]); // 撤销历史栈,支持多次撤销 const [dragOverFolder, setDragOverFolder] = useState(null); // 拖拽悬停的文件夹 @@ -1513,6 +1515,18 @@ function Sidebar() { bumpRefresh(); // 让图片区重新加载(覆盖模式下缩略图已更新) }} /> + + {/* 批量重命名弹窗 */} + setBatchRename(null)} + onFinished={(result) => { + logger.file(`批量重命名完成: ${batchRename?.folder}`, result); + bumpRefresh(); // 让图片区重新加载(文件名/路径已更新) + }} + /> {/* Library Management */}
@@ -1779,6 +1793,10 @@ function Sidebar() { menuItems.rename(() => handleStartRenameFolder(contextMenu.folder)), menuItems.move(() => handleMoveFolderClick(contextMenu.folder.path)), menuItems.divider(), + menuItems.batchRename(() => { + setContextMenu({ isOpen: false, position: null, folder: null }); + setBatchRename({ folder: contextMenu.folder.path }); + }), menuItems.batchAddWatermark(() => { setContextMenu({ isOpen: false, position: null, folder: null }); setBatchWatermark({ mode: 'add', folder: contextMenu.folder.path });