You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@uiw/react-markdown-editor

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-markdown-editor

A markdown editor with preview, implemented with React.js and TypeScript.

1.0.0
Source
npmnpm
Version published
Weekly downloads
7.9K
1.1%
Maintainers
1
Weekly downloads
 
Created
Source

A markdown editor with preview, implemented with React.js and TypeScript.

Install

npm i @uiwjs/react-markdown-editor

Basic Usage

import MarkdownEditor from '@uiwjs/react-markdown-editor';
import React from 'react';
import ReactDOM from 'react-dom';

const Dome = () => (
  <MarkdownEditor
    value={this.state.markdown}
    onChange={this.updateMarkdown}
  />
);

controlled usage

import MarkdownEditor from '@uiwjs/react-markdown-editor';
import React from 'react';
import ReactDOM from 'react-dom';


class App extends React.Component {
  constructor() {
    super();
    this.state = {
      markdown: '# This is a H1  \n## This is a H2  \n###### This is a H6',
    };
    this.updateMarkdown = this.updateMarkdown.bind(this);
  }

  updateMarkdown(editor, data, value) {
    this.setState({ markdown: value });
  }

  render() {
    return (
      <MarkdownEditor
        value={this.state.markdown}
        onChange={this.updateMarkdown}
      />
    );
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
);

Props

  • value (string) - the raw markdown that will be converted to html (required)
  • onChange (function(editor: IInstance, data: CodeMirror.EditorChange, value: string)) - called when a change is made (required)

Development

npm run dev
npm run type-check:watch
npm run doc

License

MIT © Kenny Wong

FAQs

Package last updated on 07 Apr 2019

Did you know?

Socket

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.

Install

Related posts