From 702733cb44d43a542d3820e476c2c67459936600 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Wed, 4 Dec 2024 15:52:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EB=90=9C=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=EC=84=9C=20=EC=9E=91=EC=84=B1=ED=95=A0=20=EB=95=8C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=B0=98=EC=98=81=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @noctaCrdt/Crdt.ts | 8 ++++---- client/src/features/editor/hooks/useBlockOperation.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/@noctaCrdt/Crdt.ts b/@noctaCrdt/Crdt.ts index 5b0c125d..7f76129f 100644 --- a/@noctaCrdt/Crdt.ts +++ b/@noctaCrdt/Crdt.ts @@ -294,12 +294,12 @@ export class BlockCRDT extends CRDT { }); } - if (operation.color) { - newNode.color = operation.color; + if (operation.node.color) { + newNode.color = operation.node.color; } - if (operation.backgroundColor) { - newNode.backgroundColor = operation.backgroundColor; + if (operation.node.backgroundColor) { + newNode.backgroundColor = operation.node.backgroundColor; } this.LinkedList.insertById(newNode); diff --git a/client/src/features/editor/hooks/useBlockOperation.ts b/client/src/features/editor/hooks/useBlockOperation.ts index 240a7324..481b61e9 100644 --- a/client/src/features/editor/hooks/useBlockOperation.ts +++ b/client/src/features/editor/hooks/useBlockOperation.ts @@ -92,14 +92,14 @@ export const useBlockOperation = ({ addedChar, block.id, pageId, - prevChar ? prevChar.style : [], - prevChar ? prevChar.color : undefined, - prevChar ? prevChar.backgroundColor : undefined, + prevChar?.style, + prevChar?.color, + prevChar?.backgroundColor, ); } else { // 중간에 삽입 const prevChar = editorCRDT.currentBlock?.crdt.LinkedList.findByIndex( - validCaretPosition - 1, + validCaretPosition === 1 ? 0 : validCaretPosition - 2, ); const addedChar = newContent[validCaretPosition - 1]; charNode = block.crdt.localInsert(