Touch selection handle

This commit is contained in:
Akil 2025-06-28 01:11:25 +03:00
parent ce20960d77
commit f08592e0f8

View File

@ -12,6 +12,9 @@ const SelectableParagraph = ({ content, surahNo, verseNo, onDetailClick }) => {
}); });
const handleTextSelect = (e) => { const handleTextSelect = (e) => {
// e.preventDefault();
// e.stopPropagation();
const selection = window.getSelection(); const selection = window.getSelection();
// console.log('selection', selection.toString()); // console.log('selection', selection.toString());
if (!selection || selection.toString().trim() === '') { if (!selection || selection.toString().trim() === '') {
@ -29,7 +32,7 @@ const SelectableParagraph = ({ content, surahNo, verseNo, onDetailClick }) => {
y: rect.bottom y: rect.bottom
}, },
visible: true visible: true
}); });
}; };
useEffect(() => { useEffect(() => {
@ -92,7 +95,8 @@ const SelectableParagraph = ({ content, surahNo, verseNo, onDetailClick }) => {
> >
<div <div
onMouseUp={handleTextSelect} onMouseUp={handleTextSelect}
// style={{ marginBottom: '20px', cursor: 'text' }} onTouchEnd={handleTextSelect}
onMouseDown={(e) => { onMouseDown={(e) => {
setSelection(prev => ({ ...prev, visible: false })); setSelection(prev => ({ ...prev, visible: false }));
}} }}