From 16cffe84a4d8cd91e7e5b3d1b04704f594b79d12 Mon Sep 17 00:00:00 2001 From: pipisebastian Date: Thu, 28 Nov 2024 21:29:31 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20esc=EB=A5=BC=20=EB=88=84=EB=A5=B4?= =?UTF-8?q?=EA=B1=B0=EB=82=98,=20=EC=98=B5=EC=85=98=EC=B0=BD=20=EC=99=B8?= =?UTF-8?q?=EB=B6=80=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EC=98=B5=EC=85=98?= =?UTF-8?q?=EC=B0=BD=20=EC=82=AC=EB=9D=BC=EC=A7=80=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #239 --- .../TypeOptionModal/TypeOptionModal.tsx | 74 +++++++++++-------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/client/src/features/editor/components/TypeOptionModal/TypeOptionModal.tsx b/client/src/features/editor/components/TypeOptionModal/TypeOptionModal.tsx index e808271b..9ccaac93 100644 --- a/client/src/features/editor/components/TypeOptionModal/TypeOptionModal.tsx +++ b/client/src/features/editor/components/TypeOptionModal/TypeOptionModal.tsx @@ -40,7 +40,6 @@ export const TypeOptionModal = ({ case "Enter": e.preventDefault(); onTypeSelect(options[selectedIndex].id); - onClose(); break; @@ -60,35 +59,50 @@ export const TypeOptionModal = ({ if (!isOpen) return null; return createPortal( - -
- {options.map((option, index) => ( - - ))} -
-
, + <> +
+ +
+ {options.map((option, index) => ( + + ))} +
+
+ , document.body, ); }; From 5a30e73e330d9b1c5e963cd77f4b4407ea542f2d Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Fri, 29 Nov 2024 01:39:51 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EB=A7=88=ED=81=AC=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=20=ED=83=90=EC=A7=80=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/editor/hooks/useMarkdownGrammer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/features/editor/hooks/useMarkdownGrammer.ts b/client/src/features/editor/hooks/useMarkdownGrammer.ts index e6fb2eac..a3f5e714 100644 --- a/client/src/features/editor/hooks/useMarkdownGrammer.ts +++ b/client/src/features/editor/hooks/useMarkdownGrammer.ts @@ -395,8 +395,13 @@ export const useMarkdownGrammer = ({ const selection = window.getSelection(); if (!selection) return; const currentContent = currentBlock.crdt.read(); + const currentCaret = getAbsoluteCaretPosition(e.currentTarget); const markdownElement = checkMarkdownPattern(currentContent); - if (markdownElement && currentBlock.type === "p") { + if ( + markdownElement && + currentCaret === markdownElement.length && + currentBlock.type === "p" + ) { e.preventDefault(); // 마크다운 패턴 매칭 시 타입 변경하고 내용 비우기 currentBlock.type = markdownElement.type; From 862eabe130c1388885e9d663f094085bd930ad78 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Fri, 29 Nov 2024 01:48:29 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20XSS=20=EB=B0=A9=EC=A7=80=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/editor/utils/domSyncUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/features/editor/utils/domSyncUtils.ts b/client/src/features/editor/utils/domSyncUtils.ts index 53a4a4b9..fb5f4f5a 100644 --- a/client/src/features/editor/utils/domSyncUtils.ts +++ b/client/src/features/editor/utils/domSyncUtils.ts @@ -139,7 +139,11 @@ const setsEqual = (a: Set, b: Set): boolean => { }; const sanitizeText = (text: string): string => { - return text.replace(/
/g, "\u00A0"); + return text + .replace(/
/g, "\u00A0") + .replace(//g, ">") + .replace(/&/g, "&"); }; // 배열 비교 헬퍼 함수