Bug: solve code and quote break/return #244
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #231 #233
Description:
This PR introduces updates to the Draft.js editor for better handling of
return
key presses and pasted text blocks.Changes:
Handle Return Key: We have updated the way the
return
key is handled. Now, when the user pressesshift + return
, a soft line break is inserted, allowing them to continue in the same block. If only thereturn
key is pressed withoutshift
, a new paragraph block is created. This was achieved by creating a customuseHandleReturn
hook.Handle Pasted Text: We've added a new feature that treats pasted multi-line text as a single block, rather than creating a new block for each new line. This ensures that large blocks of code or quotes pasted from an external source are kept intact as a single block. This was implemented with the
useHandlePastedText
hook.How to Test:
For Return Key:
shift + return
in the editor, it should insert a soft line break, keeping you in the same block.return
withoutshift
, it should create a new paragraph block.For Pasted Text:
Test
Screen.Recording.2023-07-24.at.11.53.20.AM.mov
These enhancements improve the user experience by allowing more control over the text formatting and structure.