|
|
@@ -67,6 +67,7 @@ import { preNotifyService } from '../pre-notify';
|
|
|
import { BULK_REINDEX_SIZE, LIMIT_FOR_MULTIPLE_PAGE_OP } from './consts';
|
|
|
import type { IPageService } from './page-service';
|
|
|
import { shouldUseV4Process } from './should-use-v4-process';
|
|
|
+import { syncLatestRevisionBodyToYjsDraft } from './sync-latest-revision-body-to-yjs-draft';
|
|
|
|
|
|
export * from './page-service';
|
|
|
|
|
|
@@ -4459,15 +4460,7 @@ class PageService implements IPageService {
|
|
|
}
|
|
|
|
|
|
async syncLatestRevisionBodyToYjsDraft(pageId: string): Promise<void> {
|
|
|
- const yjsConnectionManager = getYjsConnectionManager();
|
|
|
- await yjsConnectionManager.mdbInstance.clearDocument(pageId);
|
|
|
-
|
|
|
- const Revision = mongoose.model<IRevisionHasId>('Revision');
|
|
|
- const revision = await Revision.findOne({ pageId }).sort({ createdAt: -1 });
|
|
|
-
|
|
|
- if (revision != null) {
|
|
|
- await yjsConnectionManager.handleYDocUpdate(pageId, revision.body);
|
|
|
- }
|
|
|
+ await syncLatestRevisionBodyToYjsDraft(pageId);
|
|
|
}
|
|
|
|
|
|
async hasRevisionBodyDiff(pageId: string, comparisonTarget?: string): Promise<boolean> {
|