From 3194f46d0a531d6a5e2585d7b71411d17a3665e1 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Wed, 27 Nov 2024 17:32:32 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20sanitzeText=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=ED=95=B4=EC=84=9C=20=ED=8A=B9=EC=88=98?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=8F=84=20=EC=9D=BC=EB=B0=98=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A1=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/editor/utils/domSyncUtils.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/client/src/features/editor/utils/domSyncUtils.ts b/client/src/features/editor/utils/domSyncUtils.ts index 2260af65..ac8ad6cb 100644 --- a/client/src/features/editor/utils/domSyncUtils.ts +++ b/client/src/features/editor/utils/domSyncUtils.ts @@ -111,7 +111,7 @@ export const setInnerHTML = ({ element, block }: SetInnerHTMLProps): void => { } // 텍스트 추가 - html += sanitizeText(char.value); + html += char.value; // 다음 문자로 넘어가기 전에 현재 상태 업데이트 currentState = targetState; @@ -137,17 +137,6 @@ const setsEqual = (a: Set, b: Set): boolean => { } return true; }; - -const sanitizeText = (text: string): string => { - return text - .replace(/
/g, " ") - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -}; - // 배열 비교 헬퍼 함수 export const arraysEqual = (a: string[], b: string[]): boolean => { if (a.length !== b.length) return false; From 1fc7229742fd81ab9792389570a1896b82b7247c Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Wed, 27 Nov 2024 17:57:28 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4?= =?UTF-8?q?=20=EC=9E=85=EB=A0=A5=EC=8B=9C=20\u00A0=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/editor/utils/domSyncUtils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/features/editor/utils/domSyncUtils.ts b/client/src/features/editor/utils/domSyncUtils.ts index ac8ad6cb..53a4a4b9 100644 --- a/client/src/features/editor/utils/domSyncUtils.ts +++ b/client/src/features/editor/utils/domSyncUtils.ts @@ -111,7 +111,7 @@ export const setInnerHTML = ({ element, block }: SetInnerHTMLProps): void => { } // 텍스트 추가 - html += char.value; + html += sanitizeText(char.value); // 다음 문자로 넘어가기 전에 현재 상태 업데이트 currentState = targetState; @@ -137,6 +137,11 @@ const setsEqual = (a: Set, b: Set): boolean => { } return true; }; + +const sanitizeText = (text: string): string => { + return text.replace(/
/g, "\u00A0"); +}; + // 배열 비교 헬퍼 함수 export const arraysEqual = (a: string[], b: string[]): boolean => { if (a.length !== b.length) return false; From f7d67c054525801bc6a86453a356379fbc4a3092 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Wed, 27 Nov 2024 18:26:20 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20white-space:=20pre-wrap=EC=9D=84=20?= =?UTF-8?q?=ED=86=B5=ED=95=B4=20=EA=B3=B5=EB=B0=B1=EA=B3=BC=20=EC=A4=84?= =?UTF-8?q?=EB=B0=94=EA=BF=88=20=EC=9C=A0=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/editor/components/block/Block.style.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/features/editor/components/block/Block.style.ts b/client/src/features/editor/components/block/Block.style.ts index cb9a8b20..8b884a28 100644 --- a/client/src/features/editor/components/block/Block.style.ts +++ b/client/src/features/editor/components/block/Block.style.ts @@ -64,6 +64,8 @@ export const textContainerStyle = cva({ base: { ...baseTextStyle, position: "relative", + overflowWrap: "break-word", + whiteSpace: "pre-wrap", "&:empty::before": { color: "gray.300", pointerEvents: "none",