Skip to content

Allow to set customStyleMap on Editor#58

Merged
sstur merged 1 commit intosstur:masterfrom
andschdk:support-style-map
Jun 15, 2016
Merged

Allow to set customStyleMap on Editor#58
sstur merged 1 commit intosstur:masterfrom
andschdk:support-style-map

Conversation

@andschdk
Copy link
Copy Markdown
Contributor

This PR merges the internal styleMap const and the customStyleMap prop before setting it on Editor

In README it says:

All the props you can pass to Draft.js Editor can be passed to RichTextEditor (with the exception of editorState which will be generated internally based on the value prop).

Which is not totally right. I guess there's more props which is overridden by rte, customStyleMap is just one of them.

Thanks for an awesome draftjs wrapper.

@sstur
Copy link
Copy Markdown
Owner

sstur commented Jun 15, 2016

Good catch. This PR looks good to me!

@sstur sstur merged commit 0d6dd5c into sstur:master Jun 15, 2016
Comment thread src/RichTextEditor.js
{...otherProps}
blockStyleFn={getBlockStyle}
customStyleMap={styleMap}
customStyleMap={Object.assign(styleMap, customStyleMap)}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, this mutates the global styleMap. I have to roll back this commit.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants