|
@@ -4460,8 +4460,11 @@ class PageService implements IPageService {
|
|
|
|
|
|
|
|
async syncLatestRevisionBodyToYjsDraft(pageId: string): Promise<void> {
|
|
async syncLatestRevisionBodyToYjsDraft(pageId: string): Promise<void> {
|
|
|
const yjsConnectionManager = getYjsConnectionManager();
|
|
const yjsConnectionManager = getYjsConnectionManager();
|
|
|
|
|
+ // await yjsConnectionManager.mdbInstance.clearDocument(pageId);
|
|
|
|
|
+
|
|
|
const Revision = mongoose.model<IRevisionHasId>('Revision');
|
|
const Revision = mongoose.model<IRevisionHasId>('Revision');
|
|
|
const revision = await Revision.findOne({ pageId }).sort({ createdAt: -1 });
|
|
const revision = await Revision.findOne({ pageId }).sort({ createdAt: -1 });
|
|
|
|
|
+
|
|
|
if (revision != null) {
|
|
if (revision != null) {
|
|
|
await yjsConnectionManager.handleYDocUpdate(pageId, revision.body);
|
|
await yjsConnectionManager.handleYDocUpdate(pageId, revision.body);
|
|
|
}
|
|
}
|