-
-
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
Backspace on a fully selected content or at the beginning of the first block should ensure that paragraph is left #3065
Comments
I'd love if the functionality of backspace in case of clearing the editor contents was enhanced. Currently when I hit The expected result imho is that the editor should in such case leave me with the same state as when I initialise an empty editor, that is with an empty paragraph. |
Because we don't how the editor should behave when we press the Backspace key when the whole content in an editor is selected, I checked out how the other editors behave. I testes few editors:
Using two scenarios:
Results
|
AI prefer TinyMCE's behaviour (I selected the entire content, so I don't want styling). Although, I'm not sure whether the same should happen if there's just one block in the content. BI prefer the behaviour of TinyMCE and CKEditor 4 (which is derived from Chrome). It allows easily resetting the content to the initial state. However, I wonder if we don't see this as a more important thing than it really is because we're very frequently clearing editor's content. |
TL;DR: same thoughts as @Reinmar MS Word (tested on OSX)Case A - same as Google Docs The most intuitive solutions imho: Case AWe should type in paragraph in both cases. Reasoning: if I decided to discard everything that I had in the editor (by choosing to press Ctrl+A), then also the styling/formatting should be removed and fallback to the default. For me it is a no-brainer and any other behaviours (especially MS Word/G Docs o.O) are weird. Case BI like CKEditor 4 (and TinyMCE) approach. It seems to be quite intuitive. If I have a header as a first element and type something there (
|
With B my doubt is that let's say you start writing an article. You type: Regarding A, I'm still unsure what should happen with this: PS. @pomek, I've just realised that this feature is more complex because we can't only implement this behaviour to work in root elements. It also needs to work in such cases: <paragraph>foo</paragraph>
<image>
<caption>
<heading1>[foo</heading1>
<paragraph>bar]</paragraph>
</caption>
</image>
<paragraph>foo</paragraph> In this case, the I can see that we don't have |
I talked with @fredck and @wojtekidd and we came to a conclusion what should happen if you have
This will allow you to delete the entire content of a heading without turning it into a paragraph which adresses this issue:
However, once you are left with |
The "press backspace in empty heading/list item which starts the content to convert it to a paragraph" will let you easily end up in a paragraph after doing However, I can see that in CKEditor 4 we have cases like this one handled: Press backspace and you're immediately left with just a paragraph. The same doesn't work for a heading or block quote but works if a table or a block image start the content. I think that the lack of consistency comes from the fact that it was implemented as a chain of independent fixes for these separate features instead of being implemented as one consistent algorithm to work in all cases. Hence, I'd like to work on deleting the whole content anyway. Unconditionally. Previously I was considering treating one block selection differently than two+ blocks, but we tested it with @wwalc and we agreed that you press |
I reported a slightly related scenario in https://github.com/ckeditor/ckeditor5-list/issues/65. |
Ok, I was returned to implement this ticket and I would like to know whether I'm following a good way.
Am I right? |
I prepared few scenarios: IUser pressed Backspace in the heading element which is not empty.
IIUser pressed and held Backspace in the heading element which is not empty.
IIIUser pressed Backspace in the heading which is empty element.
IVUser pressed Backspace in the list which is empty and located inside the blockquote.
VUser pressed Backspace in the non-empty list which is located inside the blockquote.
Could you describe what should happen in |
As for cases IV step 2 – this is beyond the scope of this ticket. Unwrapping the paragraph needs to be done by the block-quote package itself. As for V – the expected result is |
As for case I – the last result should be |
My opinion: ABoth options for me are ok (the first one is simpler):
As for typing, it should behave like BNo-brainer... with Backspace we endup in an empty paragraph. |
Feature: Pressing <kbd>Backspace</kbd> or <kbd>Delete</kbd> in an empty content will reset the current block to a paragraph. Closes #61.
Like in https://github.com/ckeditor/ckeditor5-engine/issues/670.
The paragraph should be left when a full content was selected or backspace was pressed when selection was at the beginning of the first block.
The text was updated successfully, but these errors were encountered: