Fix message files handling (#210)

This commit is contained in:
Hakan Shehu
2025-09-11 11:22:40 +02:00
committed by GitHub
parent 692a0dbe87
commit 49ee759e93
2 changed files with 4 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ export class MessageCreateMutationHandler
// check if there are nested nodes (files, pages, folders etc.) // check if there are nested nodes (files, pages, folders etc.)
for (const block of Object.values(blocks)) { for (const block of Object.values(blocks)) {
if (block.type === EditorNodeTypes.TempFile) { if (block.type === EditorNodeTypes.TempFile) {
const tempFileId = block.attrs?.id; const tempFileId = block.id;
if (!tempFileId) { if (!tempFileId) {
throw new MutationError( throw new MutationError(
MutationErrorCode.FileInvalid, MutationErrorCode.FileInvalid,

View File

@@ -24,27 +24,6 @@ export const TempFileNode = Node.create({
id: { id: {
default: null, default: null,
}, },
name: {
default: null,
},
path: {
default: null,
},
size: {
default: null,
},
type: {
default: null,
},
mimeType: {
default: null,
},
extension: {
default: null,
},
url: {
default: null,
},
}; };
}, },
renderHTML({ HTMLAttributes }) { renderHTML({ HTMLAttributes }) {
@@ -66,7 +45,9 @@ export const TempFileNode = Node.create({
.focus() .focus()
.insertContentAt(pos, { .insertContentAt(pos, {
type: 'tempFile', type: 'tempFile',
attrs: file, attrs: {
id: file.id,
},
}) })
.run(); .run();