diff --git a/packages/client/src/tiptap/core/index.tsx b/packages/client/src/tiptap/core/index.tsx index 56edec90..ec6459cd 100644 --- a/packages/client/src/tiptap/core/index.tsx +++ b/packages/client/src/tiptap/core/index.tsx @@ -36,15 +36,13 @@ export const useEditor = (options: Partial = {}, deps: Dependency setEditor(instance); - if (!options.editable) { - instance.on('transaction', () => { + instance.on('transaction', () => { + requestAnimationFrame(() => { requestAnimationFrame(() => { - requestAnimationFrame(() => { - forceUpdate(); - }); + forceUpdate(); }); }); - } + }); return () => { instance.destroy(); diff --git a/packages/server/src/services/collaboration.service.ts b/packages/server/src/services/collaboration.service.ts index fe088651..2ce9ebcd 100644 --- a/packages/server/src/services/collaboration.service.ts +++ b/packages/server/src/services/collaboration.service.ts @@ -267,13 +267,14 @@ export class CollaborationService { if (docType === 'document') { const data = await this.documentService.findById(targetId); + if (data && !data.title) { await this.documentService.updateDocument({ id: userId } as IUser, targetId, { title: '未命名文档', }); } - if (editable) { + if (data && editable) { const content = data.content; const json = JSON.parse(content).default; const mentionUsers = findMentions(json);