feat: excalidraw integration (#214)

* update tiptap version

* excalidraw init

* cleanup

* better file handling and other fixes

* use different modal to fix excalidraw cursor position issue
* see https://github.com/excalidraw/excalidraw/issues/7312
* fix websocket in vite dev mode

* WIP

* add align attribute

* fix table

* menu icons

* Render image in excalidraw html
* add size to custom SVG components

* rewrite undefined font urls
This commit is contained in:
Philip Okugbe
2024-08-31 19:11:07 +01:00
committed by GitHub
parent 77b541ec71
commit 38e9eef2dc
26 changed files with 1440 additions and 799 deletions

View File

@ -75,7 +75,7 @@ export class AttachmentController {
let file = null;
try {
file = await req.file({
limits: { fileSize: maxFileSize, fields: 2, files: 1 },
limits: { fileSize: maxFileSize, fields: 3, files: 1 },
});
} catch (err: any) {
this.logger.error(err.message);
@ -112,6 +112,11 @@ export class AttachmentController {
const spaceId = page.spaceId;
const attachmentId = file.fields?.attachmentId?.value;
if (attachmentId && !isValidUUID(attachmentId)) {
throw new BadRequestException('Invalid attachment id');
}
try {
const fileResponse = await this.attachmentService.uploadFile({
filePromise: file,
@ -119,6 +124,7 @@ export class AttachmentController {
spaceId: spaceId,
userId: user.id,
workspaceId: workspace.id,
attachmentId: attachmentId,
});
return res.send(fileResponse);
@ -168,7 +174,7 @@ export class AttachmentController {
try {
const fileStream = await this.storageService.read(attachment.filePath);
res.headers({
'Content-Type': getMimeType(attachment.filePath),
'Content-Type': attachment.mimeType,
'Cache-Control': 'public, max-age=3600',
});
return res.send(fileStream);