mirror of
https://github.com/colanode/colanode.git
synced 2025-12-16 19:57:46 +01:00
Fix message files handling (#210)
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user