You need to create an editor using Draft.js within ReactJS with the following…
- User
You need to create an editor using Draft.js within ReactJS with the following specifications: There are three main components in the layout: Title, Button and Editor
- The editor needs to be written in Draft.js
- Typing
#as the first string in a line & pressing space should make anything you type afterwards on the same line be in a “Heading” format. On pressing space the aforementioned#should disappear.- See “This is a heading” line in the layout image above.
- Similarly, typing
*as the first string in a line and pressing space should correspond to “bold” format **and space = red line***and space = underline
- Typing
- Pressing
Savebutton should persist everything typed in the editor intolocalstorage. On refreshing the page, the saved info should be refilled into the editor.
- The editor needs to be written in Draft.js
- Assistant
- User
[eslint] src\components\TextEditor.jsx Line 8:84: 'ContentState' is not defined no-undef
- Assistant
- User
ERROR _this.props.onChange is not a function TypeError: _this.props.onChange is not a function at DraftEditor.update (http://localhost:3000/static/js/bundle.js:2689:19) at editOnFocus (http://localhost:3000/static/js/bundle.js:9056:12) at http://localhost:3000/static/js/bundle.js:2767:13 at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:29904:18) at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:29948:20) at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:30005:35) at invokeGuardedCallbackAndCatchFirstError (http://localhost:3000/static/js/bundle.js:30019:29) at executeDispatch (http://localhost:3000/static/js/bundle.js:34162:7) at processDispatchQueueItemsInOrder (http://localhost:3000/static/js/bundle.js:34188:11) at processDispatchQueue ()
- Assistant
- User
- Assistant
- User
- Assistant
- User
Module not found: Error: Can't resolve './editor.css' in 'C:\Users\Vishal\Documents\mycode\projects\editor\src\components'
- Assistant
- User
- Assistant
- User
looks like handleBeforeInput is not working as expected, i have added console log to test '#' but it always logs 'not-handled'
- Assistant
- User
here are my logs
- Assistant
- User
here are my logs
Block text: "" TextEditor.jsx:39 Start offset: 0 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "#" TextEditor.jsx:39 Start offset: 1 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# " TextEditor.jsx:39 Start offset: 2 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# h" TextEditor.jsx:39 Start offset: 3 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# he" TextEditor.jsx:39 Start offset: 4 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# hel" TextEditor.jsx:39 Start offset: 5 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# hell" TextEditor.jsx:39 Start offset: 6 TextEditor.jsx:80 Returning not-handled
- Assistant
- User
my input
hello
logs
- Assistant
- User
my input
hello
logs Block text: "" TextEditor.jsx:39 Start offset: 0 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "#" TextEditor.jsx:39 Start offset: 1 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# " TextEditor.jsx:39 Start offset: 2 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# h" TextEditor.jsx:39 Start offset: 3 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# he" TextEditor.jsx:39 Start offset: 4 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# hel" TextEditor.jsx:39 Start offset: 5 TextEditor.jsx:80 Returning not-handled TextEditor.jsx:38 Block text: "# hell" TextEditor.jsx:39 Start offset: 6 TextEditor.jsx:80 Returning not-handled
- Assistant