Update blocknote (#6349)

Updating blocknote providing bugfixes & new block types

---------

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
This commit is contained in:
brendanlaschke
2024-07-22 16:00:14 +02:00
committed by GitHub
parent d212aedf81
commit 4545ba2737
8 changed files with 440 additions and 358 deletions

View File

@ -1,7 +1,7 @@
import { ChangeEvent, useRef } from 'react';
import { createReactBlockSpec } from '@blocknote/react';
import styled from '@emotion/styled';
import { isNonEmptyString } from '@sniptt/guards';
import { ChangeEvent, useRef } from 'react';
import { Button } from '@/ui/input/button/components/Button';
import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
@ -65,6 +65,10 @@ export const FileBlock = createReactBlockSpec(
}
const fileUrl = await editor.uploadFile?.(file);
if (!isNonEmptyString(fileUrl)) {
return '';
}
editor.updateBlock(block.id, {
props: {
...block.props,

View File

@ -5,11 +5,15 @@ import {
IconH1,
IconH2,
IconH3,
IconHeadphones,
IconList,
IconListCheck,
IconListNumbers,
IconMoodSmile,
IconPhoto,
IconPilcrow,
IconTable,
IconVideo,
} from 'twenty-ui';
import { SuggestionItem } from '@/ui/input/editor/components/CustomSlashMenu';
@ -22,9 +26,13 @@ const Icons: Record<string, IconComponent> = {
'Heading 3': IconH3,
'Numbered List': IconListNumbers,
'Bullet List': IconList,
'Check List': IconListCheck,
Paragraph: IconPilcrow,
Table: IconTable,
Image: IconPhoto,
Video: IconVideo,
Audio: IconHeadphones,
Emoji: IconMoodSmile,
};
export const getSlashMenu = (editor: typeof blockSchema.BlockNoteEditor) => {