codex-lens 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/public/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Codex Viewer</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/main-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/main-
|
|
7
|
+
<script type="module" crossorigin src="./assets/main-Bw9MPROO.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/main-BfQHBPtk.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
package/src/components/App.jsx
CHANGED
|
@@ -448,6 +448,7 @@ function ContextMenu({ x, y, onClose, onCloseTab, onCloseOtherTabs, onCloseAllTa
|
|
|
448
448
|
|
|
449
449
|
function LeftPanel({ files, recentChanges, activeFile, onFileClick }) {
|
|
450
450
|
const [expandedDirs, setExpandedDirs] = useState({});
|
|
451
|
+
const [contextMenu, setContextMenu] = useState(null);
|
|
451
452
|
|
|
452
453
|
function toggleDir(path) {
|
|
453
454
|
setExpandedDirs(prev => ({
|
|
@@ -456,6 +457,27 @@ function LeftPanel({ files, recentChanges, activeFile, onFileClick }) {
|
|
|
456
457
|
}));
|
|
457
458
|
}
|
|
458
459
|
|
|
460
|
+
function handleContextMenu(e, item) {
|
|
461
|
+
e.preventDefault();
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
setContextMenu({
|
|
464
|
+
x: e.clientX,
|
|
465
|
+
y: e.clientY,
|
|
466
|
+
item
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function handleCopyPath() {
|
|
471
|
+
if (contextMenu?.item?.path) {
|
|
472
|
+
navigator.clipboard.writeText(contextMenu.item.path).then(() => {
|
|
473
|
+
console.log('Path copied:', contextMenu.item.path);
|
|
474
|
+
}).catch(err => {
|
|
475
|
+
console.error('Failed to copy path:', err);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
setContextMenu(null);
|
|
479
|
+
}
|
|
480
|
+
|
|
459
481
|
function renderFileTree(items, depth = 0) {
|
|
460
482
|
return items.map((item, i) => {
|
|
461
483
|
const isDir = item.type === 'directory';
|
|
@@ -468,6 +490,7 @@ function LeftPanel({ files, recentChanges, activeFile, onFileClick }) {
|
|
|
468
490
|
className={`file-item ${activeFile === item.path ? 'active' : ''}`}
|
|
469
491
|
onClick={() => isDir ? toggleDir(item.path) : null}
|
|
470
492
|
onDoubleClick={() => !isDir && onFileClick(item.path)}
|
|
493
|
+
onContextMenu={(e) => handleContextMenu(e, item)}
|
|
471
494
|
style={{ paddingLeft: `${indent}px` }}
|
|
472
495
|
>
|
|
473
496
|
<span className="file-icon">
|
|
@@ -482,7 +505,7 @@ function LeftPanel({ files, recentChanges, activeFile, onFileClick }) {
|
|
|
482
505
|
}
|
|
483
506
|
|
|
484
507
|
return (
|
|
485
|
-
<div className="panel left-panel">
|
|
508
|
+
<div className="panel left-panel" onClick={() => setContextMenu(null)}>
|
|
486
509
|
<div className="panel-header">
|
|
487
510
|
文件浏览器
|
|
488
511
|
</div>
|
|
@@ -513,6 +536,17 @@ function LeftPanel({ files, recentChanges, activeFile, onFileClick }) {
|
|
|
513
536
|
)}
|
|
514
537
|
</div>
|
|
515
538
|
</div>
|
|
539
|
+
{contextMenu && (
|
|
540
|
+
<div
|
|
541
|
+
className="file-context-menu"
|
|
542
|
+
style={{ left: contextMenu.x, top: contextMenu.y }}
|
|
543
|
+
onClick={(e) => e.stopPropagation()}
|
|
544
|
+
>
|
|
545
|
+
<div className="context-menu-item" onClick={handleCopyPath}>
|
|
546
|
+
复制文件路径
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
)}
|
|
516
550
|
</div>
|
|
517
551
|
);
|
|
518
552
|
}
|
package/src/global.css
CHANGED
|
@@ -359,6 +359,17 @@ body {
|
|
|
359
359
|
background: var(--accent-color);
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
.file-context-menu {
|
|
363
|
+
position: fixed;
|
|
364
|
+
background: var(--bg-tertiary);
|
|
365
|
+
border: 1px solid var(--border-color);
|
|
366
|
+
border-radius: 4px;
|
|
367
|
+
padding: 4px 0;
|
|
368
|
+
min-width: 150px;
|
|
369
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
370
|
+
z-index: 1000;
|
|
371
|
+
}
|
|
372
|
+
|
|
362
373
|
.task-bar {
|
|
363
374
|
display: flex;
|
|
364
375
|
align-items: center;
|