question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for draft-js-plugins

See original GitHub issue

It’d be super rad if I could do

const renderer = {
  plugins: [mentionsPlugin]
}

or something to that effect. That way I basically wouldn’t have to change anything about my setup between rendering a DraftJS plugins editor and redraft!

/cc @juliankrispel @nikgraf

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mxstbrcommented, Nov 13, 2017

I think redraft could actually handle these fairly well in core, because most of the plugins functionalities are really irrelevant for rendering. (they’re only used for editing experience changes)

The only thing redraft would need to handle is nested definitions of five methods:

  1. decorators
  2. customStyleMap
  3. blockRendererMap
  4. blockStyleFn
  5. blockRendererFn

decorators

These are already handled fairly well, it would just need to be extended to handle an array of a mixture of normal and complex decorators. See #33.

customStyleMap

This is almost the same thing as redrafts inline option, that should just also support style objects: (maybe it already does?)

const renderer = {
  inline: {
    'BOLD': {
      fontWeight: 400,
    }
  }
}

blockRendererMap

This is almost the same thing as redrafts blocks option, that should just also support the blockRendererMap notation:

const renderer = {
  blocks: {
    'unstyled': {
        element: 'div',
        aliasedElements: ['p'],
        wrapper: <ul />
    }
  }
}

blockRendererFn and blockStyleFn are the only two I’m not sure how to handle since the provided methods might use the Immutable API under the hood, which redraft doesn’t ship. Any ideas for those?

1reaction
lokiuzcommented, Jan 27, 2018

Went ahead and published the blockRendererMap support in 0.10.0 but this issue still needs some work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DraftJS Plugins - High quality plugins with great UX
Discussion and Support. Join the #draft-js-plugins channel after signing up to the DraftJS Slack organization or check out or collection of frequently asked ......
Read more >
Draft.js Plugins - GitHub
Learn about why Draft.js and how to use DraftJS Plugins. In this talk Nik Graf explained the ContentState structure of a Draft.js Editor...
Read more >
@draft-js-plugins/editor - npm
Start using @draft-js-plugins/editor in your project by running `npm i @draft-js-plugins/editor`. There are 49 other projects in the npm ...
Read more >
draft-js-plugins-editor examples - CodeSandbox
Learn how to use draft-js-plugins-editor by viewing and forking example apps that make use of draft-js-plugins-editor on CodeSandbox. ; HellCatVN/get-help.
Read more >
Overview | Draft.js
Draft.js allows you to build any type of rich text input, whether you're only looking to support a few inline text styles or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found