diff --git a/src/components/FileBrowser.jsx b/src/components/FileBrowser.jsx index 21dd6b4..7ca4c3c 100644 --- a/src/components/FileBrowser.jsx +++ b/src/components/FileBrowser.jsx @@ -308,7 +308,13 @@ export default function FileBrowser({ initialPath = '/', rootPath = '/' }) { const toggleSelect = (name) => setSelected(prev => { const next = new Set(prev); next.has(name) ? next.delete(name) : next.add(name); return next; }); - const openCtxMenu = (e, entry, childPath) => { e.preventDefault(); e.stopPropagation(); setCtxMenu({ x: e.clientX, y: e.clientY, entry, childPath }); }; + const openCtxMenu = (e, entry, childPath) => { + e.preventDefault(); e.stopPropagation(); + const menuW = 180, menuH = 320; + const x = e.clientX + menuW > window.innerWidth ? window.innerWidth - menuW - 8 : e.clientX; + const y = e.clientY + menuH > window.innerHeight ? e.clientY - menuH : e.clientY; + setCtxMenu({ x: Math.max(4, x), y: Math.max(4, y), entry, childPath }); + }; return (