Skip to content

Commit 181a7ff

Browse files
Merge pull request #24 from boostcampwm-2024/hotfix/이스케이프_문자처리_수정
Hotfix: 이스케이프 문자 처리 수정
2 parents b5124e2 + 3d60658 commit 181a7ff

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

client/src/features/editor/utils/domSyncUtils.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ export const setInnerHTML = ({ element, block }: SetInnerHTMLProps): void => {
9191

9292
// 현재 스타일이 적용된 상태라면 span으로 감싸서 추가
9393
if (hasStylesApplied(currentState) && currentSpan) {
94-
currentSpan.appendChild(document.createTextNode(sanitizeText(currentText)));
94+
currentSpan.appendChild(document.createTextNode(currentText));
9595
fragment.appendChild(currentSpan);
9696
} else {
9797
// 스타일이 없다면 일반 텍스트 노드로 추가
98-
fragment.appendChild(document.createTextNode(sanitizeText(currentText)));
98+
fragment.appendChild(document.createTextNode(currentText));
9999
}
100100
currentText = "";
101101
currentSpan = null;
@@ -267,19 +267,6 @@ const setsEqual = (a: Set<string>, b: Set<string>): boolean => {
267267
return true;
268268
};
269269

270-
const sanitizeText = (text: string): string => {
271-
return text.replace(/<br>/g, "\u00A0").replace(/[<>&"']/g, (match) => {
272-
const escapeMap: Record<string, string> = {
273-
"<": "&lt;",
274-
">": "&gt;",
275-
"&": "&amp;",
276-
'"': "&quot;",
277-
"'": "&#x27;",
278-
};
279-
return escapeMap[match] || match;
280-
});
281-
};
282-
283270
// 배열 비교 헬퍼 함수
284271
export const arraysEqual = (a: string[], b: string[]): boolean => {
285272
if (a.length !== b.length) return false;

0 commit comments

Comments
 (0)