import { defaultSelectionWrapperClassName } from '../constants/constants' import { PopoverChildrentype } from '../types' const DefaultPopover: PopoverChildrentype = ({ selection, removeSelection, updateSelection, disableMultiColorHighlight, handleCopy, identifier, }) => { const handleDelete = () => { removeSelection(selection, identifier) } const changeColor = (colorClassName: string) => { const classes = selection.className || defaultSelectionWrapperClassName const classArr = classes.split(' ') const colorIndex = classArr.findIndex((item: any) => item.startsWith('bg-')) if (colorIndex !== -1) { classArr.splice(colorIndex, 1) } classArr.push(colorClassName) updateSelection( selection.id, { ...selection, className: classArr.join(' '), }, identifier, ) } console.log(selection, 'copy selection_____') return (

{selection.text.length} characters selected

{disableMultiColorHighlight ? null : ( <>
changeColor('bg-red')} style={{ backgroundColor: '#FF407D', cursor: 'pointer', height: '25px', width: '25px', borderRadius: '50%', }} > {' '}
changeColor('bg-yellow')} style={{ backgroundColor: '#F5DD61', cursor: 'pointer', height: '25px', width: '25px', borderRadius: '50%', }} > {' '}
changeColor('bg-blue')} style={{ backgroundColor: '#59D5E0', cursor: 'pointer', height: '25px', width: '25px', borderRadius: '50%', }} > {' '}
)}
{' '} 🗑
{handleCopy && (
{ e.stopPropagation() handleCopy(selection) }} style={{ color: 'black', cursor: 'pointer', fontSize: 16 }} > {' '} copy
)}
) } export default DefaultPopover