{
e.stopPropagation();
setEditing(false);
}}
style={{ overflow: 'overlay' }}
>
{
const { inputEvent } = e;
const isMoveableElement = moveable.current?.isMoveableElement(inputEvent.target);
if ((inputEvent.type === 'touchstart' && e.isTrusted) || isMoveableElement) {
e.stop();
}
if (paperRefs.current[pageCursor] === inputEvent.target) {
onEdit([]);
}
if (inputEvent.target.id === DELETE_BTN_ID) {
removeSchemas(activeElements.map((ae) => ae.id));
}
}}
onSelect={({ added, removed, selected, inputEvent }) => {
const isClick = inputEvent.type === 'mousedown';
let newActiveElements: HTMLElement[] = isClick ? (selected as HTMLElement[]) : [];
if (!isClick && added.length > 0) {
newActiveElements = activeElements.concat(added as HTMLElement[]);
}
if (!isClick && removed.length > 0) {
newActiveElements = activeElements.filter((ae) => !removed.includes(ae));
}
onEdit(newActiveElements);
}}
/>
(
<>
{!editing && activeElements.length > 0 && (
)}
{
if (e) {
horizontalGuides.current[index] = e;
}
}}
verticalRef={(e) => {
if (e) {
verticalGuides.current[index] = e;
}
}}
/>
{pageCursor !== index ? (
) : (
!editing && (
)
)}
>
)}
renderSchema={({ schema }) => (
ae.id).includes(schema.id)}
onChange={(value) => changeSchemas([{ key: 'data', value, schemaId: schema.id }])}
border={hoveringSchemaId === schema.id ? '1px solid #18a0fb' : '1px dashed #4af'}
ref={inputRef}
/>
)}
/>
);
};
export default forwardRef