15.13.3 • Published 4 months ago

@gravity-ui/markdown-editor v15.13.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Markdown Editor

@gravity-ui/markdown-editor · npm package CI Release storybook

Markdown wysiwyg and markup editor

MarkdownEditor is a powerful tool for working with Markdown, which combines WYSIWYG and Markup modes. This means that you can create and edit content in a convenient visual mode, as well as have full control over the markup.

🔧 Main features

  • Support for the basic Markdown and YFM syntax.
  • Extensibility through the use of ProseMirror and CodeMirror engines.
  • The ability to work in WYSIWYG and Markup modes for maximum flexibility.

Install

npm install @gravity-ui/markdown-editor

Required dependencies

Please note that to start using the package, your project must also have the following installed: @diplodoc/transform, react, react-dom, @gravity-ui/uikit, @gravity-ui/components and some others. Check out the peerDependencies section of package.json for accurate information.

Getting started

The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see UIKit docs.

import React from 'react';
import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor';

function Editor({onSubmit}) {
  const editor = useMarkdownEditor({allowHTML: false});

  React.useEffect(() => {
    function submitHandler() {
      // Serialize current content to markdown markup
      const value = editor.getValue();
      onSubmit(value);
    }

    editor.on('submit', submitHandler);
    return () => {
      editor.off('submit', submitHandler);
    };
  }, [onSubmit]);

  return <MarkdownEditorView stickyToolbar autofocus editor={editor} />;
}

Read more:

Development

To start the dev storybook

npm start

i18n

To set up internationalization, you just need to use the configure:

import {configure} from '@gravity-ui/markdown-editor';

configure({
  lang: 'ru',
});

Don't forget to call configure() from UIKit and other UI libraries.

Contributing

14.12.5

8 months ago

14.12.4

8 months ago

14.12.3

8 months ago

14.12.2

8 months ago

14.12.6

8 months ago

15.3.0

8 months ago

15.3.1

8 months ago

15.7.0

6 months ago

14.12.1

8 months ago

14.5.0

11 months ago

14.12.0

8 months ago

14.5.1

11 months ago

14.9.0

10 months ago

15.13.2

5 months ago

15.13.3

4 months ago

15.13.1

5 months ago

15.0.2

8 months ago

15.0.0

8 months ago

15.0.1

8 months ago

15.4.1

7 months ago

15.4.0

7 months ago

15.4.2

7 months ago

15.8.1

6 months ago

15.8.0

6 months ago

14.2.0

11 months ago

14.2.1

11 months ago

14.2.2

11 months ago

14.11.2

8 months ago

14.2.3

11 months ago

14.11.1

9 months ago

14.6.0

10 months ago

14.11.0

9 months ago

15.10.1

6 months ago

15.10.0

6 months ago

14.10.5

9 months ago

14.10.4

9 months ago

15.1.0

8 months ago

15.5.1

7 months ago

15.9.0

6 months ago

14.3.0

11 months ago

14.3.1

11 months ago

14.10.3

9 months ago

14.10.2

10 months ago

14.10.1

10 months ago

14.7.0

10 months ago

14.10.0

10 months ago

15.11.0

6 months ago

15.11.1

5 months ago

15.2.0

8 months ago

15.2.1

8 months ago

15.6.1

6 months ago

15.2.2

8 months ago

15.6.0

6 months ago

14.0.2

12 months ago

14.0.3

12 months ago

14.4.0

11 months ago

14.13.0

7 months ago

14.8.0

10 months ago

15.12.1

5 months ago

15.12.0

5 months ago

14.0.1

12 months ago

14.0.0

12 months ago

13.25.1

1 year ago

13.25.0

1 year ago

13.23.0

1 year ago

13.21.2

1 year ago

13.22.0

1 year ago

13.21.1

1 year ago

13.21.0

1 year ago

13.20.0

1 year ago

13.21.4

1 year ago

13.24.0

1 year ago

13.21.3

1 year ago

13.19.0

1 year ago

13.18.2

1 year ago

13.18.1

1 year ago

13.18.0

1 year ago

13.17.1

1 year ago

13.17.0

1 year ago

13.16.0

1 year ago

13.15.0

1 year ago

13.14.0

1 year ago

13.13.0

1 year ago

13.12.1

1 year ago

13.12.0

1 year ago

13.11.0

1 year ago

13.10.0

1 year ago

13.9.0

1 year ago

13.8.0

1 year ago

13.7.0

1 year ago

13.6.1

1 year ago

13.6.0

1 year ago

13.5.3

1 year ago

13.5.2

1 year ago

13.5.1

1 year ago

13.5.0

1 year ago

13.4.2

1 year ago

13.4.1

1 year ago

13.4.0

1 year ago

13.3.0

1 year ago

13.2.0

1 year ago

13.1.2

1 year ago

13.1.1

1 year ago

13.1.0

1 year ago

13.0.0

1 year ago