Codelabz
Codelabz copied to clipboard
[ Feat : Reset the Quill Editor on Clicking Reset ]
Description
Added a new function named setTextContent
to the QuillEditor component, which takes a text argument. This function clears the existing content in the Quill editor and inserts the specified text, "Let's Start Refresh."
To demonstrate the functionality, a button has been directly added to the QuillEditor. This button currently triggers a refresh function, and the refresh function, in turn, calls the newly added setTextContent
function. Once the issue is assigned and reviewed by the maintainer, the plan is to connect this functionality to the main reset button.
Related Issue
Fixes #1113
Motivation and Context
When creating a tutorial to clear everything from the editor, selecting all and deleting might not be sufficient. The reset function should perform its intended purpose, which is to completely reset the editor.
How Has This Been Tested?
Tested it locally on my machine
Video :
You can observe in the console that the setTextContent
is getting called and changing. It's not getting saved after every doc update or remount, which is why the YJS document is not being initialized here. Well, it's still not completed - just a little bit left; if reviewed by the maintainer, I'll go ahead and complete it. I have thought of some of the ways we can do it... so I am open to discuss.
https://github.com/scorelab/Codelabz/assets/123815256/913c8aa3-f349-4e46-9161-29e2a2b333bb
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.