Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The decorator is unavailable for EditorState.createWithContent #589

Open
aleafo opened this issue Jan 24, 2018 · 3 comments
Open

The decorator is unavailable for EditorState.createWithContent #589

aleafo opened this issue Jan 24, 2018 · 3 comments

Comments

@aleafo
Copy link

aleafo commented Jan 24, 2018

I was trying to edit the html content made by other rich editor ( not by draft ), so the import htmlToDraft from 'html-to-draftjs' is unavailable, or else it will throw fatal error in some conditions.
But the decorator is unavailable when use the component Editor from react-draft-wysiwyg.

http://runjs.cn/code/8wgkxjp1
Just like above, it's all be ok for the decorator while using the component Editor form react-draft.

So, it must be something wrong with this plugin.

@aleafo
Copy link
Author

aleafo commented Jan 24, 2018

I found the answer by review the source code.
The decorator should be an array like this:
const decorator = [ { strategy: findImageEntities, component: Image, }, ];
And then pass it to the Editor prop.
<Editor customDecorators={decorator} />
I suggest the decorator param reserving, or else it may be difficult to decorate the data dynamically.

@aleafo aleafo closed this as completed Jan 24, 2018
@354574876
Copy link

By this way , the Image in Editor cant`t be edited

@aleafo
Copy link
Author

aleafo commented Jul 3, 2018

Yes. Images could not be edited. If you have any idea ?

@aleafo aleafo reopened this Jul 3, 2018
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

No branches or pull requests

2 participants