Skip to content

Commit 6a4de34

Browse files
authored
Merge pull request #6403 from marmelab/fix-rich-text-input-overlap
[Doc] Add mention of <RichTextInput> display bug and userland fix
2 parents 7a9ccbe + 6b3be3d commit 6a4de34

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docs/Inputs.md

+19
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,25 @@ const configureQuill = quill => quill.getModule('toolbar').addHandler('bold', fu
452452

453453
`<RichTextInput>` also accepts the [common input props](./Inputs.md#common-input-props).
454454

455+
**Tip**: When used inside a material-ui `<Card>` (e.g in the default `<Edit>` view), `<RichTextInput>` displays link tooltip as cut off when the user wants to add a hyperlink to a word located on the left side of the input. This is due to an incompatibility between material-ui's `<Card>` component and Quill's positioning algorithm for the link tooltip.
456+
457+
To fix this problem, you should override the default card style, as follows:
458+
459+
```diff
460+
import { Edit, SimpleForm, TextInput } from 'react-admin';
461+
+import { withStyles } from '@material-ui/core/styles';
462+
463+
-const PostEdit = props => (
464+
+const PostEdit = withStyles({ card: { overflow: 'initial' } })(props => (
465+
<Edit {...props}>
466+
<SimpleForm>
467+
// ...
468+
</SimpleForm>
469+
</Edit>
470+
-);
471+
+));
472+
```
473+
455474
### `<TextInput>`
456475

457476
`<TextInput>` is the most common input. It is used for texts, emails, URL or passwords. In translates to an HTML `<input>` tag.

packages/ra-input-rich-text/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ const configureQuill = quill => quill.getModule('toolbar').addHandler('bold', fu
5555
<RichTextInput source="text" configureQuill={configureQuill}/>
5656
```
5757

58+
**Tip**: When used inside a material-ui `<Card>` (e.g in the default `<Edit>` view), `<RichTextInput>` displays link tooltip as cut off when the user wants to add a hyperlink to a word located on the left side of the input. This is due to an incompatibility between material-ui's `<Card>` component and Quill's positioning algorithm for the link tooltip.
59+
60+
To fix this problem, you should override the default card style, as follows:
61+
62+
```diff
63+
import { Edit, SimpleForm, TextInput } from 'react-admin';
64+
+import { withStyles } from '@material-ui/core/styles';
65+
66+
-const PostEdit = props => (
67+
+const PostEdit = withStyles({ card: { overflow: 'initial' } })(props => (
68+
<Edit {...props}>
69+
<SimpleForm>
70+
// ...
71+
</SimpleForm>
72+
</Edit>
73+
-);
74+
+));
75+
```
76+
5877
## License
5978

6079
This library is licensed under the MIT License, and sponsored by [marmelab](https://marmelab.com).

0 commit comments

Comments
 (0)