2.0.29 • Published 20 days ago

@cmpsr/markdown-editor v2.0.29

Weekly downloads
-
License
MIT
Repository
github
Last release
20 days ago

Composer logo Composer Markdown Editor

GitHub Actions status Chromatic Actions status Storybook node version

The composer markdown editor is an opinionated React component implemented on top of lexical following and using a bunch of the playground code of the library, adapted to follow our code conventions and simplified to match our specific use case.

Using the library

yarn add @cmpsr/components @cmpsr/markdown-editor

The @cmpsr/markdown-editor library requires react, react-dom and @cmpsr/components libraries to be installed in your project.

In order to get the component properly styled it has to be rendered inside a ComposerProvider component. Example of usage:

import React, { FC } from "react";
import { ComposerProvider } from "@cmpsr/components";
import { MarkdownEditor } from "@cmpsr/markdown-editor";

type Props = {
  value?: string;
  onChange?: (v: string) => void;
  placeholder?: string;
};

export const MyEditor: FC<Props> = ({ value, onChange, placeholder }) => (
  <ComposerProvider>
    <MarkdownEditor
      initialValue={value}
      onChange={onChange}
      placeholder={placeholder}
      height="350px"
      width="100%"
    />
  </ComposerProvider>
);

Initial value

This component is not a controlled component, the initialValue will only be set once to the first non falsy value provided, once a value is set subsequent values sent to the component will be ignored. For example in the following code the value set inside the setTimeout will be discarded by the MarkdownEditor and # First value will be used.

export const WithInitialValue = () => {
  const [value, setValue] = useState("# First value");

  useEffect(() => {
    setTimeout(() => {
      setValue("# Second value");
    }, 1000);
  }, []);

  return <MarkdownEditor initialValue={value} />;
};

Releasing your changes

Before creating the pull request you have to generate a changeset for your components, follow the instructions in here.

2.0.29

20 days ago

2.0.28

1 month ago

2.0.27

2 months ago

2.0.16

6 months ago

2.0.19

5 months ago

2.0.17

6 months ago

2.0.18

5 months ago

2.0.26

3 months ago

2.0.24

3 months ago

2.0.25

3 months ago

2.0.22

4 months ago

2.0.23

4 months ago

2.0.20

5 months ago

2.0.21

4 months ago

2.0.15

6 months ago

2.0.14

6 months ago

2.0.13

7 months ago

2.0.12

7 months ago

2.0.11

7 months ago

2.0.10

7 months ago

2.0.9

8 months ago

2.0.8

8 months ago

2.0.7

8 months ago

2.0.6

9 months ago

2.0.5

10 months ago

2.0.4

10 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

1.3.7

10 months ago

1.3.6

10 months ago

1.3.5

11 months ago

1.3.4

12 months ago

1.3.3

12 months ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago

0.0.0-alpha.1

1 year ago

0.0.0-alpha

1 year ago

0.0.1

1 year ago