-
Notifications
You must be signed in to change notification settings - Fork 25
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
Protection against current code-block removing #33
base: master
Are you sure you want to change the base?
Protection against current code-block removing #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests that show the broken behavior and what this fixes please? Thanks!
If I understand this correctly, when you're in an empty code block with the cursor at the first line, i.e. like so: (where
Rather than trying to remove the (non-existant) indentation we just let DraftJS handle it instead? What's not working about this right now? |
You can try it here with backspace |
Ohhh I see, that's annoying, great catch! Let's get some tests in here to make sure this doesn't happen again accidentally, and then let's ship it 🚀 |
I'll try to add tests tomorrow |
Awesome, thank you! There's a bunch of tests already, you can just model them after that 👌 |
- fixed previous commit changes; - added test;
Hi, this should go after previous PRs. We don't need
getIndentation.js
anymore.When we are at the beginning of line at our
code-block
we can remove it by making attempt to go back to previous indent. Here we are checking the current indent and if it zero and this is the first line of thecode-block
, we do nothing.