Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 채팅 마크다운 수정 #238

Closed
wants to merge 1 commit into from
Closed

Conversation

glowisn
Copy link
Collaborator

@glowisn glowisn commented Jan 5, 2024

Checklist

  • Code Review: 작성한 코드를 다시 한 번 꼼꼼이 확인했나요?
  • Testing: 앱이 잘 구동되는지 개발한 기능이 문제 없이 작동하는지 확인했나요?
  • Remove: print나 주석 등 필요없는 코드를 삭제했나요?
  • Deleted Dependencies: dependency 삭제?

Description

close #213
react-markdown pacakge를 삭제했습니다.
마크다운 패키지 없이 인풋 코드를 읽어 `로 시작하고 끝나는 singleQuote, ```로 시작하고 끝나는 tripleQuote인 경우에 코드로 감지하여 박스에 넣어 렌더링하게 헀습니다.

기존의 react-markdown을 쓰는 방식은 여러 마크다운을 지원하고 코드이 양의 적어 편리했지만, 렌더링된 컴포넌트 자체를 함수에서 반환함으로써 좌우 크기 조절이 되지 않은 상태로 렌더링 되었습니다.
그 문제를 해결하기 위해 newline character를 길이에 맞게 삽입하는 방식으로 코드를 일단 구현했었습니다. 이에 직접 인풋 값을 감지하여 코드로 판별될 경우 박스와 함께 렌더링하도록 수정했습니다.

  • 일반적 상황에서 좌우 스크롤 문제 해결 (더 좋은 방식)
  • 코드 이외의 다른 마크다운 문법은 적용되지 않아 - 나 # 등을 사용 가능합니다.

Changes Made

client/package.json : react-markdown 패키지 삭제
client/src/components/Room/Chat.tsx : insertNewline 함수 및 로직 삭제
client/src/components/Room/MessageBody.tsx : 마크다운 패키지 삭제 및 대응 코드

Demo

image

@glowisn glowisn self-assigned this Jan 5, 2024
Copy link
Collaborator

@kiuuon kiuuon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Collaborator

@Lukaid-dev Lukaid-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
이것도 고도화가 필요해보이긴 하네요

@glowisn glowisn marked this pull request as draft January 8, 2024 12:13
@vimkim vimkim deleted the branch develop February 5, 2024 10:38
@vimkim vimkim closed this Feb 5, 2024
@glowisn glowisn deleted the refactor/Chat-MarkDowm branch February 7, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor : 마크다운 줄 바꿈
4 participants