Giter Site home page Giter Site logo

react-prosemirror-document's Introduction

react-prosemirror-document

Render a ProseMirror document in JSON-format using React

Installation

npm install --save react-prosemirror-document

Usage

var ProseMirrorDocument = require('react-prosemirror-document');
var pmDocument = {
  type: 'doc',
  content: [{
    type: 'paragraph',
    content: [{
      type: 'text',
      text: 'Lets add a link to '
    }, {
      type: 'text',
      text: 'my website',
      marks: [{
        type: 'link',
        href: 'https://espen.codes/',
        title: 'Espen.Codes (personal website)'
      }]
    }, {
      type: 'text',
      text: ' for fun an profit.'
    }]
  }]
};

ReactDOM.render(<ProseMirrorDocument document={pmDocument} />, document.body)

Props

  • document - (required) object The JSON prosemirror document to render
  • typeMap - object An object where the keys represent the types in a prosemirror document and the values refer to the component that should be used for rendering it. The default type map is overriden when using this, so if you just want to extend the defaults, be sure to use something like Object.assign or similar to merge your own types with the ones from ProseMirrorDocument.typeMap
  • markMap - object An object where the keys represent the marks in a prosemirror document and the values refer to the component that should be used for rendering it. The default mark map is overriden when using this, so if you just want to extend the defaults, be sure to use something like Object.assign or similar to merge your own types with the ones from ProseMirrorDocument.markMap
  • skipUnknownMarks - boolean Set to true to simply skip any unknown marks. Default is false, which will throw an error when encountering unknown marks.
  • skipUnknownTypes - boolean Set to true to simply skip any unknown types. Default is false, which will throw an error when encountering unknown types.

License

MIT-licensed, see LICENSE.

react-prosemirror-document's People

Contributors

forbeslindesay avatar rexxars avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.