-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
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
[Beta: CodeMirror] User can undo past the current challenge #16960
Comments
@raisedadead we need to call clearHistory of codemirror to get rid of undo history when new challenge comes. But when we know that this is new challenge so that we can clear history in Editor.jsx? componentWillMount and componentWillUpdate does not seem right for this. Any Suggestion? |
You should be able to hook it to an action in the editor, when a new challenge arrives. /cc @Bouncey can you guide. |
Yes i am getting id of challenge to compare if this challenge is new in componentWillUpdate and then clearing history. This is working fine expect for the first time. Working on this. |
@raisedadead @Bouncey There are two ways to do this
Settimeout is required because codemirror does not give updated value when new challenge is selected as of this issue JedWatson/react-codemirror#106
So Any Suggestion which one to use? |
I would want to move away to using https://github.com/scniro/react-codemirror2 however, in case its not trivial at the moment I would prefer your second solution. |
yes codemirror2 seems a right option, for now i am raising PR with second solution. |
clear codemirror undo stack on new challenge Closes freeCodeCamp#16960 fix(editor): Removed not required code Closes freeCodeCamp#16960 feat(editor): Updated code with coding style Closes freeCodeCamp#16960
Challenge Name
Any challenge with a code editor.
Issue Description
Steps to reproduce:
Browser Information
Screenshot
The text was updated successfully, but these errors were encountered: