-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Undo by pressing backspace: AutoFormat #10508
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.
Some remarks:
- The feature works fine on the technical level.
- I'm not sure applying this behavior to headings, blockquotes, code blocks, or horizontal lines is very useful, though. It's very unlikely anyone begins their block with
###
,>
,```
or---
and they really want this sequence to be preserved because this is how they start the sentence. It's more likely they'll create headings/blockquotes/code blocks/etc. and want to press backspace and get rid of the whole block because they changed their mind.- OTOH, it makes sense for numbered lists because I can imagine starting a sentence with
1.
and not wanting to create a list. Same with ordered lists, for instance, if they write footnotes they might want their sentence to start with*
so they can superscript it later. - Maybe we could disable it for certain formattings then?
- OTOH, it makes sense for numbered lists because I can imagine starting a sentence with
- Come to think of it, I'm not sure how this feature could be useful for basic style formattings either (those that do not start with
^
in their regexps). I mean, it works fine but how is**abc**
a useful sequence anyone would like to have in their content? Backspacing to remove "c" seems more logical than undoing the autoformatting.- Unlike the case with lists, I see no strong reason against enabling it for basic styles, though. It's a nice gimmick, I guess.
- I couldn't find any other UX issues with this new behavior. I thought composition will break but I failed to find any scenario that would prove it.
- No other text editor act like this. I'm curious why?
TL;DR
I'd enable this feature for ordered, numbered lists, and maybe for basic styles (because it looks cool). Then I'd wait for feedback from the community.
This behavior could be an argument of blockAutoformatEditing()
and inlineAutoformatEditing()
so 3rd-party integrators can decide what they want.
@@ -203,4 +186,88 @@ describe( 'Autoformat undo integration', () => { | |||
expect( getData( model ) ).to.equal( '<paragraph>> []</paragraph>' ); | |||
} ); | |||
} ); | |||
|
|||
describe( 'should undo by pressing backspace', () => { |
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.
We'll need a paranoid-integration-check-test here to make sure this does not happen when the selection changed in the meanwhile. It does not mean we have to double all requestUndoOnBackspace()
tests here, just a single assertion will do.
Sounds good. The reasoning (that you often need to revert the autoformat in these cases) works for me.
You wrote yourself that "I'm not sure how this feature could be useful for basic style formatting". I agree that it looks cool there, though. My big worry here, if we start to choose arbitrarily in which cases backspace works would be, though, that it will be a constant surprise to the user. So, I think that viable options are:
|
Let's go this way. We'll be consistent and have feedback (if anyone is annoyed by that). |
…oformat' into ck/10413-backspace-reverting-autoformat
Suggested merge commit message (convention)
Feature (autoformat): Allowed undoing automatic Markdown-like formatting by pressing Backspace. See #10413.
Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.