Skip to content

Commit 3038887

Browse files
committed
fix: yjs 서비스 develop 브랜치 버전으로 롤백
1 parent e20a92c commit 3038887

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

apps/backend/src/yjs/yjs.service.ts

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export class YjsService
6767
const editorDoc = doc.getXmlFragment('default');
6868
const customDoc = editorDoc.doc as CustomDoc;
6969

70+
if (customDoc.name === 'users') {
71+
return;
72+
}
73+
7074
// document name이 flow-room이라면 모든 노드들을 볼 수 있는 화면입니다.
7175
// 노드를 클릭해 페이지를 열었을 때만 해당 페이지 값을 가져와서 초기 데이터로 세팅해줍니다.
7276
if (customDoc.name?.startsWith('document-')) {
@@ -109,18 +113,18 @@ export class YjsService
109113
editorDoc.observeDeep(() => {
110114
const document = editorDoc.doc as CustomDoc;
111115
const pageId = parseInt(document.name.split('-')[1]);
112-
// this.pageService.updatePage(
113-
// pageId,
114-
// JSON.parse(
115-
// JSON.stringify(yXmlFragmentToProsemirrorJSON(editorDoc)),
116-
// ),
117-
// );
118-
119-
this.redisService.setField(
120-
pageId.toString(),
121-
'content',
122-
JSON.stringify(yXmlFragmentToProsemirrorJSON(editorDoc)),
116+
this.pageService.updatePage(
117+
pageId,
118+
JSON.parse(
119+
JSON.stringify(yXmlFragmentToProsemirrorJSON(editorDoc)),
120+
),
123121
);
122+
123+
// this.redisService.setField(
124+
// pageId.toString(),
125+
// 'content',
126+
// JSON.stringify(yXmlFragmentToProsemirrorJSON(editorDoc)),
127+
// );
124128
// this.redisService.get(pageId.toString()).then((data) => {
125129
// console.log(data);
126130
// });
@@ -154,17 +158,17 @@ export class YjsService
154158
title.observeDeep(async (event) => {
155159
// path가 존재할 때만 페이지 갱신
156160
event[0].path.toString().split('_')[1] &&
157-
// this.pageService.updatePage(
158-
// parseInt(event[0].path.toString().split('_')[1]),
159-
// {
160-
// title: event[0].target.toString(),
161-
// },
162-
// );
163-
this.redisService.setField(
164-
event[0].path.toString().split('_')[1],
165-
'title',
166-
event[0].target.toString(),
161+
this.pageService.updatePage(
162+
parseInt(event[0].path.toString().split('_')[1]),
163+
{
164+
title: event[0].target.toString(),
165+
},
167166
);
167+
// this.redisService.setField(
168+
// event[0].path.toString().split('_')[1],
169+
// 'title',
170+
// event[0].target.toString(),
171+
// );
168172
});
169173
emoji.observeDeep((event) => {
170174
// path가 존재할 때만 페이지 갱신

0 commit comments

Comments
 (0)