This commit is contained in:
Anthony Stirling 2025-11-10 18:18:21 +00:00
parent 559ba3ccab
commit 5fadb92f51

View File

@ -756,6 +756,7 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
isChanged: boolean,
content: React.ReactNode,
onActivate?: (event: React.MouseEvent) => void,
onClick?: (event: React.MouseEvent) => void,
) => (
<Box
component="div"
@ -783,17 +784,15 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
}}
onClick={(event) => {
event.stopPropagation();
if (onClick) {
onClick(event);
} else {
onActivate?.(event);
}}
onMouseEnter={() => setActiveGroupId(groupId)}
onMouseLeave={() => {
if (editingGroupId !== groupId) {
setActiveGroupId((current) => (current === groupId ? null : current));
}
}}
>
{content}
{isActive && editingGroupId !== groupId && (
{activeGroupId === groupId && editingGroupId !== groupId && (
<ActionIcon
size="xs"
variant="filled"
@ -1502,7 +1501,10 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
{group.text || '\u00A0'}
</span>
</div>,
undefined,
(event: React.MouseEvent) => {
// Double-click to edit
if (event.detail === 2) {
// Capture click position BEFORE switching to edit mode
const clickX = event.clientX;
const clickY = event.clientY;
@ -1548,6 +1550,10 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
}
}, 10);
});
} else {
// Single click just selects
setActiveGroupId(group.id);
}
},
)}
</Box>