mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-11-16 01:21:16 +01:00
x button
This commit is contained in:
parent
559ba3ccab
commit
5fadb92f51
@ -756,6 +756,7 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
|
|||||||
isChanged: boolean,
|
isChanged: boolean,
|
||||||
content: React.ReactNode,
|
content: React.ReactNode,
|
||||||
onActivate?: (event: React.MouseEvent) => void,
|
onActivate?: (event: React.MouseEvent) => void,
|
||||||
|
onClick?: (event: React.MouseEvent) => void,
|
||||||
) => (
|
) => (
|
||||||
<Box
|
<Box
|
||||||
component="div"
|
component="div"
|
||||||
@ -783,17 +784,15 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
|
|||||||
}}
|
}}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
if (onClick) {
|
||||||
|
onClick(event);
|
||||||
|
} else {
|
||||||
onActivate?.(event);
|
onActivate?.(event);
|
||||||
}}
|
|
||||||
onMouseEnter={() => setActiveGroupId(groupId)}
|
|
||||||
onMouseLeave={() => {
|
|
||||||
if (editingGroupId !== groupId) {
|
|
||||||
setActiveGroupId((current) => (current === groupId ? null : current));
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
{isActive && editingGroupId !== groupId && (
|
{activeGroupId === groupId && editingGroupId !== groupId && (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
size="xs"
|
size="xs"
|
||||||
variant="filled"
|
variant="filled"
|
||||||
@ -1502,7 +1501,10 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
|
|||||||
{group.text || '\u00A0'}
|
{group.text || '\u00A0'}
|
||||||
</span>
|
</span>
|
||||||
</div>,
|
</div>,
|
||||||
|
undefined,
|
||||||
(event: React.MouseEvent) => {
|
(event: React.MouseEvent) => {
|
||||||
|
// Double-click to edit
|
||||||
|
if (event.detail === 2) {
|
||||||
// Capture click position BEFORE switching to edit mode
|
// Capture click position BEFORE switching to edit mode
|
||||||
const clickX = event.clientX;
|
const clickX = event.clientX;
|
||||||
const clickY = event.clientY;
|
const clickY = event.clientY;
|
||||||
@ -1548,6 +1550,10 @@ const PdfJsonEditorView = ({ data }: PdfJsonEditorViewProps) => {
|
|||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// Single click just selects
|
||||||
|
setActiveGroupId(group.id);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user