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,
|
||||
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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user