Merge pull request #150 from fantasticit/fix/delete

This commit is contained in:
fantasticit 2022-08-08 19:13:52 +08:00 committed by GitHub
commit 4ae76f3d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -36,15 +36,13 @@ export const useEditor = (options: Partial<EditorOptions> = {}, deps: Dependency
setEditor(instance); setEditor(instance);
if (!options.editable) { instance.on('transaction', () => {
instance.on('transaction', () => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { forceUpdate();
forceUpdate();
});
}); });
}); });
} });
return () => { return () => {
instance.destroy(); instance.destroy();

View File

@ -267,13 +267,14 @@ export class CollaborationService {
if (docType === 'document') { if (docType === 'document') {
const data = await this.documentService.findById(targetId); const data = await this.documentService.findById(targetId);
if (data && !data.title) { if (data && !data.title) {
await this.documentService.updateDocument({ id: userId } as IUser, targetId, { await this.documentService.updateDocument({ id: userId } as IUser, targetId, {
title: '未命名文档', title: '未命名文档',
}); });
} }
if (editable) { if (data && editable) {
const content = data.content; const content = data.content;
const json = JSON.parse(content).default; const json = JSON.parse(content).default;
const mentionUsers = findMentions(json); const mentionUsers = findMentions(json);