|
1 | 1 | import * as React from 'react';
|
2 | 2 | import { ReactElement, ReactNode, useEffect } from 'react';
|
3 |
| -import clsx from 'clsx'; |
4 |
| -import { useEditor, Editor, EditorOptions, EditorContent } from '@tiptap/react'; |
5 |
| -import StarterKit from '@tiptap/starter-kit'; |
6 |
| -import Underline from '@tiptap/extension-underline'; |
| 3 | +import { FormHelperText } from '@mui/material'; |
| 4 | +import { styled } from '@mui/material/styles'; |
| 5 | +import { Color } from '@tiptap/extension-color'; |
| 6 | +import Highlight from '@tiptap/extension-highlight'; |
| 7 | +import Image from '@tiptap/extension-image'; |
7 | 8 | import Link from '@tiptap/extension-link';
|
8 | 9 | import TextAlign from '@tiptap/extension-text-align';
|
9 |
| -import Image from '@tiptap/extension-image'; |
10 | 10 | import TextStyle from '@tiptap/extension-text-style';
|
11 |
| -import { Color } from '@tiptap/extension-color'; |
12 |
| -import Highlight from '@tiptap/extension-highlight'; |
13 |
| -import { FormHelperText } from '@mui/material'; |
14 |
| -import { styled } from '@mui/material/styles'; |
| 11 | +import Underline from '@tiptap/extension-underline'; |
| 12 | +import { Editor, EditorContent, EditorOptions, useEditor } from '@tiptap/react'; |
| 13 | +import StarterKit from '@tiptap/starter-kit'; |
| 14 | +import clsx from 'clsx'; |
15 | 15 | import { useInput, useResourceContext } from 'ra-core';
|
16 | 16 | import {
|
17 | 17 | CommonInputProps,
|
18 | 18 | InputHelperText,
|
19 | 19 | Labeled,
|
20 | 20 | LabeledProps,
|
21 | 21 | } from 'ra-ui-materialui';
|
22 |
| -import { TiptapEditorProvider } from './TiptapEditorProvider'; |
| 22 | + |
23 | 23 | import { RichTextInputToolbar } from './RichTextInputToolbar';
|
| 24 | +import { TiptapEditorProvider } from './TiptapEditorProvider'; |
24 | 25 |
|
25 | 26 | /**
|
26 | 27 | * A rich text editor for the react-admin that is accessible and supports translations. Based on [Tiptap](https://www.tiptap.dev/).
|
@@ -163,8 +164,10 @@ export const RichTextInput = (props: RichTextInputProps) => {
|
163 | 164 | };
|
164 | 165 |
|
165 | 166 | editor.on('update', handleEditorUpdate);
|
| 167 | + editor.on('blur', field.onBlur); |
166 | 168 | return () => {
|
167 | 169 | editor.off('update', handleEditorUpdate);
|
| 170 | + editor.off('blur', field.onBlur); |
168 | 171 | };
|
169 | 172 | }, [editor, field]);
|
170 | 173 |
|
|
0 commit comments