Skip to content
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

Replaces empty selected text blocks when inserting new blocks #5054

Closed
notnownikki opened this issue Feb 14, 2018 · 7 comments
Closed

Replaces empty selected text blocks when inserting new blocks #5054

notnownikki opened this issue Feb 14, 2018 · 7 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.

Comments

@notnownikki
Copy link
Member

Issue Overview

If I have my cursor in an empty paragraph block, and I use the inserter to insert a new heading or paragraph block, it transforms the block into a heading, or does nothing. But, if I have my cursor in an empty heading block and use the inserter to insert a new paragraph or heading, a new one is inserted, every time. In both cases, the title of the inserter is "add block", but it does different things.

Apparently there is some philosophical discussion about "is an empty block a block"? But from a UI perspective, an empty block looks like a block and behaves like a block, but the inserter changes behaviour, and there's no hint about what behaviour it's going to do.

Steps to Reproduce (for bugs)

  1. Have an empty paragraph block
  2. "Insert" a heading. Heading will replace the block.
  3. Have an empty heading block.
  4. Insert a heading. Heading will actually be inserted.

Expected Behavior

The inserter's behaviour should be consistent. Even if we're saying "empty blocks get transformed", it should consistently do this.

@youknowriad
Copy link
Contributor

Adding a design feedback as this is an intended behavior described in #4951

@youknowriad youknowriad added [Type] Question Questions about the design or development of the editor. Needs Design Feedback Needs general design feedback. labels Feb 14, 2018
@jasmussen
Copy link
Contributor

This ticket seems to touch upon a larger issue, that seems to have been surfaced as other refinements take care of the obvious stuff, making the less obvious but still important stuff suddenly shine brighter.

For the case in point, the empty paragraph block has become the commandline. It's a magical block that allows you to start typing to make it a text block, or use the slash command to insert, or use the recent blocks interface on the right to replace it entirely.

This is cool, because it's a singular interface you get access to whenever you make a linebreak.

But why doesn't this work in all text blocks, including the Heading?

  • Why can't I use the slash command in all text blocks?
  • Why aren't all text blocks replaced when inserting another block into it?

The reason why the empty paragraph block is replaced when it's empty and you insert another block, is because we are trying to adhere to what would happen in a non-block editor. You'd put the caret on an empty line, insert an image, and then you'd now have an image instead of an empty paragraph. But I do agree, it would be nice if this behavior was the same across all basic text blocks.

I don't know how hard that would be for us to accomplish, but it would definitely be worth looking into.

Also related: #3785 (comment)

@notnownikki
Copy link
Member Author

For the case in point, the empty paragraph block has become the commandline.

This is why I stay away from design discussions, so I can help test from the point of view of someone who doesn't know that the commandline is even a thing 😄

@jasmussen
Copy link
Contributor

For consistency, it would be nice if an empty Heading block behaved the same as an empty Paragraph block. That is, the slash command works, the inline inserter works, and inserting replaces the whole thing.

It is something that would be nice to have, so marking the priority as such.

@jasmussen jasmussen added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label Mar 6, 2018
@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Mar 7, 2018
@designsimply designsimply added the [Feature] Inserter The main way to insert blocks using the + button in the editing interface label Aug 1, 2018
@youknowriad youknowriad changed the title Inserter sometimes replaces empty blocks, and sometimes inserts after Replaces empty selected text blocks when inserting new blocks Apr 3, 2019
@youknowriad youknowriad added [Type] Enhancement A suggestion for improvement. and removed [Type] Question Questions about the design or development of the editor. labels Apr 3, 2019
@paaljoachim
Copy link
Contributor

paaljoachim commented Jan 22, 2021

@jasmussen

As work is happening around the empty text blocks these days. #13599 and #28275 etc
I believe we can also do something with this issue as well.

@paaljoachim
Copy link
Contributor

Should this issue be closed as work is happening in relation to other issues?

@mrfoxtalbot
Copy link

mrfoxtalbot commented Jul 14, 2023

The behaviour seems to be consistent now: adding a new heading while on an empty block, will replace the empty block. This is what I am seeing:

Kapture.2023-07-14.at.11.29.08.mp4

I am going to close this but please feel free to re-open if needed, @notnownikki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants