Update blocknote (#6349)
Updating blocknote providing bugfixes & new block types --------- Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
This commit is contained in:
@ -6,8 +6,9 @@
|
|||||||
"@aws-sdk/client-lambda": "^3.614.0",
|
"@aws-sdk/client-lambda": "^3.614.0",
|
||||||
"@aws-sdk/client-s3": "^3.363.0",
|
"@aws-sdk/client-s3": "^3.363.0",
|
||||||
"@aws-sdk/credential-providers": "^3.363.0",
|
"@aws-sdk/credential-providers": "^3.363.0",
|
||||||
"@blocknote/core": "^0.12.1",
|
"@blocknote/core": "^0.15.3",
|
||||||
"@blocknote/react": "^0.12.2",
|
"@blocknote/mantine": "^0.15.3",
|
||||||
|
"@blocknote/react": "^0.15.3",
|
||||||
"@chakra-ui/accordion": "^2.3.0",
|
"@chakra-ui/accordion": "^2.3.0",
|
||||||
"@chakra-ui/system": "^2.6.0",
|
"@chakra-ui/system": "^2.6.0",
|
||||||
"@codesandbox/sandpack-react": "^2.13.5",
|
"@codesandbox/sandpack-react": "^2.13.5",
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ChangeEvent, useRef } from 'react';
|
|
||||||
import { createReactBlockSpec } from '@blocknote/react';
|
import { createReactBlockSpec } from '@blocknote/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
|
import { ChangeEvent, useRef } from 'react';
|
||||||
|
|
||||||
import { Button } from '@/ui/input/button/components/Button';
|
import { Button } from '@/ui/input/button/components/Button';
|
||||||
import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
|
import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
|
||||||
@ -65,6 +65,10 @@ export const FileBlock = createReactBlockSpec(
|
|||||||
}
|
}
|
||||||
const fileUrl = await editor.uploadFile?.(file);
|
const fileUrl = await editor.uploadFile?.(file);
|
||||||
|
|
||||||
|
if (!isNonEmptyString(fileUrl)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
editor.updateBlock(block.id, {
|
editor.updateBlock(block.id, {
|
||||||
props: {
|
props: {
|
||||||
...block.props,
|
...block.props,
|
||||||
|
|||||||
@ -5,11 +5,15 @@ import {
|
|||||||
IconH1,
|
IconH1,
|
||||||
IconH2,
|
IconH2,
|
||||||
IconH3,
|
IconH3,
|
||||||
|
IconHeadphones,
|
||||||
IconList,
|
IconList,
|
||||||
|
IconListCheck,
|
||||||
IconListNumbers,
|
IconListNumbers,
|
||||||
|
IconMoodSmile,
|
||||||
IconPhoto,
|
IconPhoto,
|
||||||
IconPilcrow,
|
IconPilcrow,
|
||||||
IconTable,
|
IconTable,
|
||||||
|
IconVideo,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
|
||||||
import { SuggestionItem } from '@/ui/input/editor/components/CustomSlashMenu';
|
import { SuggestionItem } from '@/ui/input/editor/components/CustomSlashMenu';
|
||||||
@ -22,9 +26,13 @@ const Icons: Record<string, IconComponent> = {
|
|||||||
'Heading 3': IconH3,
|
'Heading 3': IconH3,
|
||||||
'Numbered List': IconListNumbers,
|
'Numbered List': IconListNumbers,
|
||||||
'Bullet List': IconList,
|
'Bullet List': IconList,
|
||||||
|
'Check List': IconListCheck,
|
||||||
Paragraph: IconPilcrow,
|
Paragraph: IconPilcrow,
|
||||||
Table: IconTable,
|
Table: IconTable,
|
||||||
Image: IconPhoto,
|
Image: IconPhoto,
|
||||||
|
Video: IconVideo,
|
||||||
|
Audio: IconHeadphones,
|
||||||
|
Emoji: IconMoodSmile,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSlashMenu = (editor: typeof blockSchema.BlockNoteEditor) => {
|
export const getSlashMenu = (editor: typeof blockSchema.BlockNoteEditor) => {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ClipboardEvent, useCallback, useMemo } from 'react';
|
|
||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCreateBlockNote } from '@blocknote/react';
|
import { useCreateBlockNote } from '@blocknote/react';
|
||||||
import { isArray, isNonEmptyString } from '@sniptt/guards';
|
import { isArray, isNonEmptyString } from '@sniptt/guards';
|
||||||
|
import { ClipboardEvent, useCallback, useMemo } from 'react';
|
||||||
import { useRecoilCallback, useRecoilState } from 'recoil';
|
import { useRecoilCallback, useRecoilState } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
@ -30,7 +30,8 @@ import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
|||||||
|
|
||||||
import { getFileType } from '../files/utils/getFileType';
|
import { getFileType } from '../files/utils/getFileType';
|
||||||
|
|
||||||
import '@blocknote/react/style.css';
|
import '@blocknote/core/fonts/inter.css';
|
||||||
|
import '@blocknote/mantine/style.css';
|
||||||
|
|
||||||
type ActivityBodyEditorProps = {
|
type ActivityBodyEditorProps = {
|
||||||
activityId: string;
|
activityId: string;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useRef } from 'react';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { useRef } from 'react';
|
||||||
|
|
||||||
import { ActivityBodyEditor } from '@/activities/components/ActivityBodyEditor';
|
import { ActivityBodyEditor } from '@/activities/components/ActivityBodyEditor';
|
||||||
import { ActivityBodyEffect } from '@/activities/components/ActivityBodyEffect';
|
import { ActivityBodyEffect } from '@/activities/components/ActivityBodyEffect';
|
||||||
@ -11,8 +11,6 @@ import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
|||||||
|
|
||||||
import { ActivityTitle } from './ActivityTitle';
|
import { ActivityTitle } from './ActivityTitle';
|
||||||
|
|
||||||
import '@blocknote/core/style.css';
|
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { ClipboardEvent } from 'react';
|
|
||||||
import { filterSuggestionItems } from '@blocknote/core';
|
import { filterSuggestionItems } from '@blocknote/core';
|
||||||
import { BlockNoteView, SuggestionMenuController } from '@blocknote/react';
|
import { BlockNoteView } from '@blocknote/mantine';
|
||||||
|
import { SuggestionMenuController } from '@blocknote/react';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { ClipboardEvent } from 'react';
|
||||||
|
|
||||||
import { blockSchema } from '@/activities/blocks/schema';
|
import { blockSchema } from '@/activities/blocks/schema';
|
||||||
import { getSlashMenu } from '@/activities/blocks/slashMenu';
|
import { getSlashMenu } from '@/activities/blocks/slashMenu';
|
||||||
@ -40,6 +41,10 @@ const StyledEditor = styled.div`
|
|||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
& .bn-block-content[data-content-type='checkListItem'] > div > div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const BlockEditor = ({
|
export const BlockEditor = ({
|
||||||
|
|||||||
@ -108,6 +108,7 @@ export {
|
|||||||
IconLink,
|
IconLink,
|
||||||
IconLinkOff,
|
IconLinkOff,
|
||||||
IconList,
|
IconList,
|
||||||
|
IconListCheck,
|
||||||
IconListNumbers,
|
IconListNumbers,
|
||||||
IconLock,
|
IconLock,
|
||||||
IconLockOpen,
|
IconLockOpen,
|
||||||
@ -163,4 +164,5 @@ export {
|
|||||||
IconWand,
|
IconWand,
|
||||||
IconWorld,
|
IconWorld,
|
||||||
IconX,
|
IconX,
|
||||||
|
IconMoodSmile,
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
|
|||||||
Reference in New Issue
Block a user