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

Add ability to add single new-line when typing Shift + Enter #559

Open
2 tasks
iamthomasbishop opened this issue Feb 7, 2019 · 33 comments
Open
2 tasks
Labels
[Pri] Low [Type] Enhancement Improves a current area of the editor

Comments

@iamthomasbishop
Copy link
Contributor

iamthomasbishop commented Feb 7, 2019

Current Behavior

Currently when I'm focused on a text block (paragraph, heading) and type Shift + Enter, a new block is created – which is the same behavior as typing Enter.

Expected Behavior

I expect that if I type Shift + Enter in a block, it should simply add a single new-line instead of creating a new block.

Implementation coverage

  • Android
  • iOS
@iamthomasbishop iamthomasbishop added the [Type] Bug Something isn't working label Feb 7, 2019
@iamthomasbishop iamthomasbishop added this to the Beta milestone Feb 7, 2019
@iamthomasbishop iamthomasbishop self-assigned this Feb 7, 2019
@SergioEstevao SergioEstevao self-assigned this Feb 19, 2019
@SergioEstevao
Copy link
Contributor

@iamthomasbishop I tested this on iOS and it works if you apply Shift+Enter in the middle of the paragraph/block.

That said I did found a bug when you try to do this and the end of the paragraph that makes the system crash.

@iamthomasbishop
Copy link
Contributor Author

Hmm, that's not what I'm seeing – maybe this was fixed in a more recent build than the beta I'm testing on (HockeyApp). Here's what I'm seeing, for reference:

shift_enter_bugs

@SergioEstevao
Copy link
Contributor

@iamthomasbishop you are right the Shift+Enter it's only working when using a my laptop keyboard to do it, if I use the device touch keyboard I get the block split.

@koke
Copy link
Member

koke commented Feb 21, 2019

@diegoreymendez may confirm but IIRC we tried something similar on aztec and this was impossible to detect on iOS on the screen keyboard

@diegoreymendez
Copy link
Contributor

This isn't supported in iOS. It's only possible through a hardware keyboard.

@diegoreymendez diegoreymendez modified the milestones: Beta, Future Feb 21, 2019
@diegoreymendez
Copy link
Contributor

Sorry, I closed this by mistake and reopened it.

@iamthomasbishop
Copy link
Contributor Author

This isn't supported in iOS. It's only possible through a hardware keyboard.

@diegoreymendez Fair enough. Just tested on Google Docs and Dropbox Paper and it's the same thing. So we can ax this issue for now if we need to.

@hypest
Copy link
Contributor

hypest commented Mar 14, 2019

Shift-Enter with external keyboards would still be useful and perhaps even more when on tablets so, I'd leave this ticket open.

@iamthomasbishop Is it OK with you to just rename it to "... on external keyboards"?

@SergioEstevao
Copy link
Contributor

SergioEstevao commented Mar 14, 2019 via email

@hypest
Copy link
Contributor

hypest commented Jul 25, 2019

Let's find a workaround to enable users to input line breaks without paragraph split. It's really frustrating to do it when one really wants it, to nicely format small paragraphs like the following (think: a small poem. h/t @madeincosmos):

Soft line breaks
Within a
Single block

Followed by
Another
Block underneath

@mchowning
Copy link
Contributor

mchowning commented Aug 2, 2019

I noticed something that probably isn't directly helpful but might point the way for some possible solutions...

On both Android and iOS it seems we can get soft-enter-like behavior sometimes if you type very quickly (not swipe) and then hit enter. The video below is from an Android release build not connected to the bundler (so I don't think it was just the result of a bundler delay, although I suspect it may still be related to the asynchronous communication across the bridge). I wasn't able to tell why it would sometimes give me a soft enter and sometimes not.

soft-new-line mp4

@mchowning
Copy link
Contributor

Currently, pressing enter on image captions does create a new line instead of adding a new empty paragraph block. When addressing this, it would be good to give consistent behavior to the image caption as well.

@SergioEstevao SergioEstevao added the [Type] Enhancement Improves a current area of the editor label May 4, 2020
@designsimply
Copy link
Contributor

Noting that this came up in Slack and that Eli suggested possibly adding a button to the toolbar as a potential solution.

(internal reference: p1602473723029700-slack-cellular-happiness)

@azollafox
Copy link

From an app review on Google Play

Block Editor: Would be great if there was a way to break a line ( ) Because with an Enter on the smartphone keyboard there is always a new block and "Shift + Enter" none of my keyboards know (3 different installed)

@reginabally
Copy link

Another request in an app review on Google Play:

It would be helpful to have line breaks within the block.

@reginabally
Copy link

Requested in 3642791-zen.

As a matter of fact, it is not possible in WP app, to easily begin a new line within a block. Hitting RETURN will begin a new block, and Shift-RETURN as known from former times in simple editors, doesn't work.
Adressing this "feature" before, I was told a workaround by going to HTML-modus and filling in
at the wanted position. Which of course is very anoying, doing this lots of times in a posting.

@mdrockwell
Copy link

3827600-zen

I can't press enter to go down to the next line without it opening in a separate text block. I'm trying to have two lines of text right beneath each other in the same block.

@guarani
Copy link
Contributor

guarani commented May 5, 2021

Another request in an app review on Google Play:

And I hate to see a new block created EVERYTIME I hit enter.

@guarani
Copy link
Contributor

guarani commented May 5, 2021

And another request in an app review on Google Play:

Every time I press the Enter key, a new writing box is opened, although I actually only wanted to make a line break instead of starting a new paragraph.

@mchowning
Copy link
Contributor

mchowning commented May 13, 2021

@iamthomasbishop tested and confirmed that shift+enter behavior works for both iPad and iPhones when accessing Gutenberg on the web. Combined with the fact that shift+enter works in the iOS notes app, this gives some hope that maybe something changed and maybe this is now possible. 🤞

@guarani
Copy link
Contributor

guarani commented May 19, 2021

It looks like it isn't currently possible to support Shift+Enter on iOS, more info below.

@iamthomasbishop tested and confirmed that shift+enter behavior works for both iPad and iPhones when accessing Gutenberg on the web. Combined with the fact that shift+enter works in the iOS notes app, this gives some hope that maybe something changed and maybe this is now possible. 🤞

After a bit of investigation and collaboration on the team, we found that iOS only provides a public API for Shift key events when using an external (physical) keyboard via the pressesBegan functions. This API doesn't work with the on-screen virtual keyboard. The iOS Notes app is likely using a private API that we can't use in the WPiOS app (see code here) (h/t @koke).

Regarding mobile Safari, using JavaScript it's possible to detect the Shift key being pressed (although it doesn't seem possible to differentiate between it being held and being "on"). This won't help us here though, since Gutenberg Mobile uses something completely different, an Aztec (UITextView) instance.


An alternative here could be to invert the app's behavior and make soft new-lines the default when pressing Enter. That way, users could add a new Paragraph block when needed, otherwise they can press Enter to create a new line.

@reginabally
Copy link

Feedback from a user in 4410487-zd-woothemes:

There’s no reason to make a text block each time you hit Enter!

@thabotswana
Copy link

3-star iOS app review

I have tried to use shift+return but it always create new paragraph instead of new line

@reginabally
Copy link

Another request in 4715088-zd-woothemes:

Can you tell me how to start a new line rather than a new paragraph when writing text? I am using the Wordpress app on an iPad so shift+enter doesnt work.

@erricgunawan
Copy link

4745458-zen (translated):

Please tell me how to start a new line on the edit screen in visual mode.

If you press the line feed button, the block will change.

@eduardozulian
Copy link

4860430-zen

User's idea: Hit Enter once for next line, twice for new block.

@igotdes
Copy link

igotdes commented Mar 18, 2022

Also mentioned in #4856871-zen:

[...] When I am creating a post and writing a textual entry, perhaps in prose, perhaps in verse, if I press return, it always skips a line and creates an irritating space where none is required.

@reginabally
Copy link

Asked in 4940586-zd-woothemes:

How do I enter a carriage return (soft return) in a paragraph block. I’m on the iOS app. Is that format not supported?

@igotdes
Copy link

igotdes commented May 9, 2022

From 1-star Google Play review:

I do have a problem. Whenever, I want to go to the next line and I click enter, a new paragraph is launched

@erricgunawan
Copy link

3-star Google Play review:

The big problem is that I don't want to switch to the next block immediately with Enter on the Android keyboard.

@rinazrina
Copy link

Another user expecting this works on phone: #37318217-hc

@SiobhyB
Copy link
Contributor

SiobhyB commented Mar 7, 2024

From a recent one star review:

Disastrous experience. I think the developer lacks a basic understanding that in a paragraph, when U seperate the content from its heading that doesn't mean we want to create a totally new block. Imagine a para having its Heading and Content in seperate blocks with wide space between them. Its make their appearance awful. Developer needs to improve that by clicking ENTER key, we don't mean to create extra block but to give the para an effect like that of a content written just under its heading.

@alinclamba
Copy link

Another user reported this 8567227-zd-a8c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Low [Type] Enhancement Improves a current area of the editor
Projects
None yet
Development

No branches or pull requests