Skip to content

Commit

Permalink
fix:모바일 퀴즈 복사 방지
Browse files Browse the repository at this point in the history
  • Loading branch information
moaguide authored Nov 12, 2024
1 parent 81917fe commit a7ce70d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/quiz/QuizQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ interface QuizQuestionsProps {
const QuizQuestions: React.FC<QuizQuestionsProps> = ({ questions, answers, onAnswerChange }) => {
useEffect(() => {
// 오른쪽 클릭 방지
const handleContextMenu = (e: MouseEvent) => e.preventDefault();
const handleContextMenu = (e: MouseEvent | TouchEvent) => e.preventDefault();
document.addEventListener('contextmenu', handleContextMenu);
document.addEventListener('touchstart', handleContextMenu);

// 텍스트 선택 방지
document.body.style.userSelect = 'none';
Expand All @@ -34,6 +35,7 @@ const QuizQuestions: React.FC<QuizQuestionsProps> = ({ questions, answers, onAns
// 컴포넌트 언마운트 시 이벤트 제거
return () => {
document.removeEventListener('contextmenu', handleContextMenu);
document.removeEventListener('touchstart', handleContextMenu);
document.removeEventListener('keydown', handleKeyDown);
document.body.style.userSelect = 'auto';
};
Expand Down

0 comments on commit a7ce70d

Please sign in to comment.