➕(app-impress) add @blocknote/mantine
The new version of blocknote dissociates the ux from the @blocknote/react package. It is now in a separate package @blocknote/mantine. We add this package to the impress app. We adapt the toolbar to fit the new package.
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blocknote/core": "0.13.2",
|
"@blocknote/core": "0.13.2",
|
||||||
|
"@blocknote/mantine": "0.13.2",
|
||||||
"@blocknote/react": "0.13.2",
|
"@blocknote/react": "0.13.2",
|
||||||
"@openfun/cunningham-react": "2.9.0",
|
"@openfun/cunningham-react": "2.9.0",
|
||||||
"@tanstack/react-query": "5.36.0",
|
"@tanstack/react-query": "5.36.0",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { BlockNoteEditor as BlockNoteEditorCore } from '@blocknote/core';
|
import { BlockNoteEditor as BlockNoteEditorCore } from '@blocknote/core';
|
||||||
import { BlockNoteView } from '@blocknote/react';
|
import { BlockNoteView } from '@blocknote/mantine';
|
||||||
import '@blocknote/react/style.css';
|
import '@blocknote/react/style.css';
|
||||||
import React, { useEffect, useMemo } from 'react';
|
import React, { useEffect, useMemo } from 'react';
|
||||||
import { WebrtcProvider } from 'y-webrtc';
|
import { WebrtcProvider } from 'y-webrtc';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import '@blocknote/mantine/style.css';
|
||||||
import {
|
import {
|
||||||
BasicTextStyleButton,
|
BasicTextStyleButton,
|
||||||
BlockTypeSelect,
|
BlockTypeSelect,
|
||||||
@@ -9,11 +10,10 @@ import {
|
|||||||
NestBlockButton,
|
NestBlockButton,
|
||||||
ReplaceImageButton,
|
ReplaceImageButton,
|
||||||
TextAlignButton,
|
TextAlignButton,
|
||||||
ToolbarButton,
|
|
||||||
UnnestBlockButton,
|
UnnestBlockButton,
|
||||||
useBlockNoteEditor,
|
useBlockNoteEditor,
|
||||||
|
useComponentsContext,
|
||||||
} from '@blocknote/react';
|
} from '@blocknote/react';
|
||||||
import '@blocknote/react/style.css';
|
|
||||||
import { forEach, isArray } from 'lodash';
|
import { forEach, isArray } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
@@ -95,6 +95,7 @@ const recursiveContent = (content: Block[], base: string = '') => {
|
|||||||
*/
|
*/
|
||||||
export function MarkdownButton() {
|
export function MarkdownButton() {
|
||||||
const editor = useBlockNoteEditor();
|
const editor = useBlockNoteEditor();
|
||||||
|
const Components = useComponentsContext();
|
||||||
|
|
||||||
const handleConvertMarkdown = () => {
|
const handleConvertMarkdown = () => {
|
||||||
const blocks = editor.getSelection()?.blocks;
|
const blocks = editor.getSelection()?.blocks;
|
||||||
@@ -118,12 +119,16 @@ export function MarkdownButton() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!Components) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ToolbarButton
|
<Components.FormattingToolbar.Button
|
||||||
mainTooltip="Convert Markdown"
|
mainTooltip="Convert Markdown"
|
||||||
onClick={handleConvertMarkdown}
|
onClick={handleConvertMarkdown}
|
||||||
>
|
>
|
||||||
M
|
M
|
||||||
</ToolbarButton>
|
</Components.FormattingToolbar.Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user