import * as React from 'react'; import Popover from '@mui/material/Popover'; import Typography from '@mui/material/Typography'; import Paper from '@mui/material/Paper'; export default function VirtualElementPopover() { const [open, setOpen] = React.useState(false); const [anchorEl, setAnchorEl] = React.useState(null); const handleClose = () => { setOpen(false); }; const handleMouseUp = () => { const selection = window.getSelection(); // Skip if selection has a length of 0 if (!selection || selection.anchorOffset === selection.focusOffset) { return; } const getBoundingClientRect = () => { return selection.getRangeAt(0).getBoundingClientRect(); }; setOpen(true); setAnchorEl({ getBoundingClientRect, nodeType: 1 }); }; const id = open ? 'virtual-element-popover' : undefined; return (