Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

draft-material.ui-editor

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draft-material.ui-editor

Draft.js editor for React+Material UI projects

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Overview

This packages consists of a rich text editor component based on Draft.js and Material UI, and corresponding viewer component. It allows you to store rich text either in Draft.js's raw format or markdown format.

MarkdownEditor

This is an WYSIWIG rich text editor component. It takes either raw (Draft.js's raw format) or markdown data as the resource prop (if you give both, it uses raw), and calls back onSave (with markdown and raw), onCancel or onDelete when the user performs those operations.

  function onSave(markdown, raw) {
    // store either raw or markdown to the database
  }
  const raw = ... // load it from the database
  const resource = { raw }; // or markdown
  return (
    <MarkdownEditor 
      resource={resource} 
      onSave={onSave} 
      onCancel={onCancel} 
      onDelete={onDelete} />
  )

MarkdownViewer

This is a corresponding viewer component, which takes either raw or markdown data as the resource prop.

  return (
    <MarkdownViewer 
      resource={resource} />
  )

raw vs. markdown

The raw format is a Draft.JS specific format, which works really well but not necessarily portable. I recommand to use this format in most of cases.

The markdown format is a portable format, which is a good format to exchange rich text documents. However, the conversion between raw and markdown is not perfect (it uses draft-js-export-markdown and draft-js-import-markdown), and you may see some unexpected results.

Keywords

FAQs

Package last updated on 08 Aug 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc