feat: editor file attachments (#194)

* fix current slider value

* WIP

* changes to extension attributes

* update command title
This commit is contained in:
Philip Okugbe
2024-08-26 12:38:47 +01:00
committed by GitHub
parent 7e80797e3f
commit 7dc37b933f
19 changed files with 450 additions and 16 deletions

View File

@ -27,6 +27,7 @@ import {
TiptapImage,
TiptapVideo,
TrailingNode,
Attachment,
} from '@docmost/editor-ext';
import { generateText, JSONContent } from '@tiptap/core';
import { generateHTML } from '../common/helpers/prosemirror/html';
@ -65,6 +66,7 @@ export const tiptapExtensions = [
TiptapImage,
TiptapVideo,
Callout,
Attachment,
CustomCodeBlock
] as any;

View File

@ -16,4 +16,4 @@ export const InlineFileExtensions = [
'.mp4',
'.mov',
];
export const MAX_FILE_SIZE = '20MB';
export const MAX_FILE_SIZE = '50MB';

View File

@ -123,6 +123,11 @@ export class AttachmentController {
return res.send(fileResponse);
} catch (err: any) {
if (err?.statusCode === 413) {
const errMessage = `File too large. Exceeds the ${MAX_FILE_SIZE} limit`;
this.logger.error(errMessage);
throw new BadRequestException(errMessage);
}
this.logger.error(err);
throw new BadRequestException('Error processing file upload.');
}

View File

@ -38,7 +38,6 @@ export async function prepareFile(
mimeType: file.mimetype,
};
} catch (error) {
console.error('Error in file preparation:', error);
throw error;
}
}