jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.42k stars 1.16k forks source link

Error in docs code example for Uncontrolled editor #443

Open PrimeLens opened 7 years ago

PrimeLens commented 7 years ago

Hi - I'm still trying to figure out how to edit an already saved draft post when I came across an error in the examples in the docs. Here are the steps to recreate the issue and I've included a link to a repo that demonstrates the error

Steps to recreate

1) create-react-app draft-wysiwyg-error-uncontrolled-editor 2) cd draft-wysiwyg-error-uncontrolled-editor 3) npm install --save react-draft-wysiwyg 4) npm install --save draft-js 5) go to https://jpuri.github.io/react-draft-wysiwyg/#/docs and copy paste the Uncontrolled editor using RawDraftContentState. code block example into App.js 6) change class UncontrolledEditor to class App 7) npm run start

screengrab_of_error
jpuri commented 7 years ago

Hey @PrimeLens , do you also see this error in the docs page ?

PrimeLens commented 7 years ago

yes, this is copy paste from the docs

jpuri commented 7 years ago

Since this error does not happens in docs, looks like trouble in way its copied.

PrimeLens commented 7 years ago

Yes that is true ... but when a user copies and pastes your code from the docs page into a brand new react app the error occurs.

I have made simple steps to replicate.

I provided a simple repo to demonstrate. (see link in original post)

PrimeLens commented 7 years ago

Sorry I edited my post above.

When you wrote "this error does not happens in docs" it is incorrect it is happening in the docs. Possibly you were thinking this does not happen in the demo's? The demo's do not cover this code from your docs. The only place it exists that I can see is by going to Uncontrolled editor using RawDraftContentState at https://jpuri.github.io/react-draft-wysiwyg/#/docs and copy pasting.

jpuri commented 7 years ago

Plz check example - 2 here

PrimeLens commented 7 years ago

Example 2 uses convertFromRaw, your docs I pointed out use RawDraftContentState Please read my comments carefully

divinzer commented 6 years ago

same issue