ra-input-markdown

1.4.0 • Public • Published

<MarkdownInput> for react-admin

npm npm

For editing Markdown with react-admin, use the <MarkdownInput> component. It uses react-med, a popular React Markdown Editor.

<MarkdownInput> example

Installation

npm install --save ra-input-markdown
# or
yarn add ra-input-markdown

Usage

import React from 'react';
import {
    DateInput,
    Edit,
    EditButton,
    LongTextInput,
    TextInput,
} from 'react-admin';
import MarkdownInput from 'ra-input-markdown';

const PostTitle = ({ record }) => {
    return <span>Post {record ? `"${record.title}"` : ''}</span>;
};

export const PostEdit = (props) => (
    <Edit title={<PostTitle />} {...props}>
        <DisabledInput label="Id" source="id" />
        <TextInput source="title" validation={{ required: true }} />
        <LongTextInput source="teaser" validation={{ required: true }} />
        <MarkdownInput source="body" />
        <DateInput label="Publication date" source="published_at" />
    </Edit>
);

Readme

Keywords

none

Package Sidebar

Install

npm i ra-input-markdown

Weekly Downloads

50

Version

1.4.0

License

MIT

Unpacked Size

12.5 kB

Total Files

9

Last publish

Collaborators

  • maluramichael