
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
ra-input-rich-text
Advanced tools
<RichTextInput> component for react-admin, useful for editing HTML code in admin GUIs.
A rich text editor for React Admin, based on TipTap.
npm install ra-input-rich-text
# or
yarn add ra-input-rich-text
Use it as you would any react-admin input:
import { Edit, SimpleForm, TextInput } from 'react-admin';
import { RichTextInput } from 'ra-input-rich-text';
export const PostEdit = () => (
<Edit>
<SimpleForm>
<TextInput source="title" />
<RichTextInput source="body" />
</SimpleForm>
</Edit>
);
The <RichTextInput>
component has a toolbar
prop that accepts a ReactNode
.
You can leverage this to change the buttons size:
import { Edit, SimpleForm, TextInput } from 'react-admin';
import { RichTextInput, RichTextInputToolbar } from 'ra-input-rich-text';
export const PostEdit = () => (
<Edit>
<SimpleForm>
<TextInput source="title" />
<RichTextInput source="body" toolbar={<RichTextInputToolbar size="large" />} />
</SimpleForm>
</Edit>
);
Or to remove some prebuilt components like the <AlignmentButtons>
:
import {
RichTextInput,
RichTextInputToolbar,
LevelSelect,
FormatButtons,
ListButtons,
LinkButtons,
QuoteButtons,
ClearButtons,
} from 'ra-input-rich-text';
const MyRichTextInput = ({ size, ...props }) => (
<RichTextInput
toolbar={
<RichTextInputToolbar>
<LevelSelect size={size} />
<FormatButtons size={size} />
<ListButtons size={size} />
<LinkButtons size={size} />
<QuoteButtons size={size} />
<ClearButtons size={size} />
</RichTextInputToolbar>
}
label="Body"
source="body"
{...props}
/>
);
You might want to add more TipTap extensions. The <RichTextInput>
component accepts an editorOptions
prop, which is the object passed to the TipTap Editor.
If you just want to add extensions, don't forget to include those needed by default for our implementation. Here's an example to add the HorizontalRule node:
import {
DefaultEditorOptions,
RichTextInput,
RichTextInputToolbar,
LevelSelect,
FormatButtons,
AlignmentButtons,
ListButtons,
LinkButtons,
QuoteButtons,
ClearButtons,
} from 'ra-input-rich-text';
import HorizontalRule from '@tiptap/extension-horizontal-rule';
import Remove from '@mui/icons-material/Remove';
const MyRichTextInput = ({ size, ...props }) => (
<RichTextInput
editorOptions={MyEditorOptions}
toolbar={
<RichTextInputToolbar>
<LevelSelect size={size} />
<FormatButtons size={size} />
<AlignmentButtons {size} />
<ListButtons size={size} />
<LinkButtons size={size} />
<QuoteButtons size={size} />
<ClearButtons size={size} />
<ToggleButton
aria-label="Add an horizontal rule"
title="Add an horizontal rule"
onClick={() => editor.chain().focus().setHorizontalRule().run()}
selected={editor && editor.isActive('horizontalRule')}
>
<Remove fontSize="inherit" />
</ToggleButton>
</RichTextInputToolbar>
}
label="Body"
source="body"
{...props}
/>
);
export const MyEditorOptions = {
...DefaultEditorOptions,
extensions: [
...DefaultEditorOptions.extensions,
HorizontalRule,
],
};
This data provider is licensed under the MIT License, and sponsored by Marmelab.
5.8.4
Datagrid
by DataTable
in Guessers (#10754) (erwanMarmelab)<DataTable>
crashes when its data is not a React primitive (#10777) (djhi)useGetOne
returns an error in shadcn-admin-kit
(#10776) (jonathanarnault)<BooleanInput>
(#10773) (Madeorsk)<SaveButton>
is not enabled when the form is prefilled (from <CloneButton>
for instance) (#10765) (djhi)create-react-admin
(#10778) (djhi)convertRaMessagesToI18next
to convertRaTranslationsToI18next
(#10774) (Madeorsk)<DataTable>
docs (#10775) (Madeorsk)FAQs
<RichTextInput> component for react-admin, useful for editing HTML code in admin GUIs.
The npm package ra-input-rich-text receives a total of 10,227 weekly downloads. As such, ra-input-rich-text popularity was classified as popular.
We found that ra-input-rich-text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket investigates hidden protestware in npm packages that blocks user interaction and plays the Ukrainian anthem for Russian-language visitors.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.