Skip to content

Commit

Permalink
fix: 스타일 적용된 텍스트 이어서 작성할 때 서버 반영 안되는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludovico7 committed Dec 4, 2024
1 parent 7118d78 commit 702733c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions @noctaCrdt/Crdt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ export class BlockCRDT extends CRDT<Char> {
});
}

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);
Expand Down
8 changes: 4 additions & 4 deletions client/src/features/editor/hooks/useBlockOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 702733c

Please sign in to comment.