This commit is contained in:
seb
2026-10-07 13:23:44 +02:00
parent 6c0b1503e8
commit 7045fe5e69
5 changed files with 140 additions and 202 deletions

View File

@@ -2,7 +2,6 @@ import React, { PureComponent } from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import FolderOpenRoundedIcon from '@mui/icons-material/FolderOpenRounded';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
@@ -61,13 +60,20 @@ export default class VfsEditorPanel extends PureComponent {
this.unsub?.();
}
handleMentionInChat = (file) => {
handleMentionInChat = (file, lineInfo = null) => {
if (!file) return;
if (this.props.onInsertToChat) {
const isImg = file.isImage;
const tag = isImg
? `![${file.name}](${file.name})`
: `[${file.name}](${file.name})`;
let tag = '';
if (lineInfo?.startLine) {
const lineRef =
lineInfo.startLine === lineInfo.endLine
? `L${lineInfo.startLine}`
: `L${lineInfo.startLine}-L${lineInfo.endLine}`;
tag = `[${file.name}#${lineRef}](${file.name}#${lineRef})`;
} else {
tag = isImg ? `![${file.name}](${file.name})` : `[${file.name}](${file.name})`;
}
this.props.onInsertToChat(tag);
}
};
@@ -116,7 +122,7 @@ export default class VfsEditorPanel extends PureComponent {
onSave={() => vfsAutomat.actions.saveCurrentFile()}
onClose={() => vfsAutomat.actions.selectFile(null)}
onDownload={() => vfsAutomat.actions.downloadFile(selectedFileName)}
onMentionInChat={() => this.handleMentionInChat(selectedFile)}
onMentionInChat={(lineInfo) => this.handleMentionInChat(selectedFile, lineInfo)}
/>
) : selectedFileName && !selectedFile?.isText ? (
/* Single Column Mode: Preview (Image, PDF, Binary) */
@@ -147,19 +153,17 @@ export default class VfsEditorPanel extends PureComponent {
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<FolderOpenRoundedIcon color="primary" sx={{ fontSize: 22 }} />
<Typography variant="subtitle1" fontWeight={700}>
VFS Dateisystem
Dateien
</Typography>
</Box>
<Tooltip title="VFS-Dateisystem schließen">
<IconButton
size="small"
onClick={() => vfsAutomat.actions.closeVfs()}
aria-label="VFS schließen"
>
<CloseRoundedIcon fontSize="small" />
</IconButton>
</Tooltip>
<IconButton
size="small"
onClick={() => vfsAutomat.actions.closeVfs()}
aria-label="VFS schließen"
>
<CloseRoundedIcon fontSize="small" />
</IconButton>
</Box>
<Box sx={{ flexGrow: 1, minHeight: 0, overflow: 'hidden' }}>