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

Support for multiple line-breaks within a single paragraph #2872

Closed
kravemir opened this issue Dec 14, 2019 · 14 comments
Closed

Support for multiple line-breaks within a single paragraph #2872

kravemir opened this issue Dec 14, 2019 · 14 comments

Comments

@kravemir
Copy link

kravemir commented Dec 14, 2019

Lines and paragraphs are not same things in typography. Usually, there's a spacing between paragraphs, which less than the height of a full line, unless there are different elements involved like figures, headings,... And, sometimes, there's a need to use multiple simple line-breaks for the same paragraph.

Steps for Reproduction

  1. Visit https://quilljs.com/ (demo editor),
  2. Experiment a bit with line breaks (single enter press, double enter press,...),
  3. Inspect class="ql-editor" component.

Expected behavior:

There can be produced output allowing multiple line-breaks within a single paragraph, like:

<p>Some text paragraph</p>
<p>
  Another text paragraph:<br/>
  with<br/>
  multiple<br/>
  lines
<p>
<p>Another paragraph</p>

Actual behavior:

Can't produce output above.

Suggested behaviour

Simply: when an enter is pressed once, then a line-break is produced. When enter is pressed twice, then a new paragraph is produced.

Technically:

  • when enter is pressed after text (ie. single enter press), then a new line is produced,
  • when enter is pressed at the beginning of the line (ie. double enter press), then the line is converted to paragraph.
  • when delete is pressed on the beginning of the line, then line is merged with previous one,
  • when delete is pressed on the beginning of the paragraph, then paragraph is converted to line, and belongs to previous paragraph.

Not covered:

  • how to treat multiple successive empty lines/paragraphs.

Platforms:

$ uname -a
Linux miroslav-laptop 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ google-chrome --version
Google Chrome 78.0.3904.108 

Version:

The published one, when this issue is written.

@markleppke
Copy link

To support this issue, here is the HTML spec relating to semantic markup: https://www.w3.org/TR/html52/textlevel-semantics.html#elementdef-br

@kmsomebody
Copy link

+1
This is one of the most basic features that every text editor must have. Has no one written a module for that?

@npcole
Copy link

npcole commented Jun 13, 2020

+1
This is an essential feature for digital humanities work — both for editing academic writing and for editing transcriptions of primary texts.

@npcole
Copy link

npcole commented Jun 13, 2020

(Though whether this should be done automatically — or with a shift enter — is very much open to debate. Following most word processors, it should be the latter.)

@maxfahl
Copy link

maxfahl commented Oct 27, 2020

I'd really like to see shift+enter being added to Quill. It seems the maintainers don't see this as an issue though, they have locked/closed threads discussing this feature before. There are some experimental implementation made by people, but they don't work as expected. Too bad this is not being taken seriously. I really love this editor and dislike the fact that a common thing such as this is deterring people from using it. Me included.

@jwhiting
Copy link

jwhiting commented May 8, 2021

What we need is a Parchment implementation that can be added as a module to core. As seen in #252 which is old and locked, Quill maintainers don't think this behavior should be in core, but that it should be feasible as a module. I'm new to Quill but am willing to help with that effort, if someone more experienced with the internals knows a path through the woods. The module probably needs a configuration to set shift+enter vs enter means new paragraph vs new line break. Also, this could be applicable to blockquotes and perhaps other block elements, which like paragraphs, don't currently support entry of multiple lines in Quill, either. Note that the code block format does seem to support this, so perhaps that's a good place to start.

@Jagadeeswarh
Copy link

@jwhiting Did you find any working solution?

@jwhiting
Copy link

@Jagadeeswarh no I have not found anything existing. I think it needs to be written, and for that I need assistance from someone with more experience on Quill in this regard. Please chime in if you find anything, and I will do the same. For now I'm just punting on the issue and living with the default Quill behavior.

@athanasius-kircher
Copy link

At least I stumbled about this: https://codepen.io/mackermedia/pen/gmNwZP.

@herrbasan
Copy link

I agree that this is learned/standard behavior and should be part of the core functionality. Might this be an issue of an overly opinionated author ?

@NikolaDojic
Copy link

+1

1 similar comment
@NikolaDojic
Copy link

+1

@AlvaroDeen
Copy link

nothing yet?

@quill-bot
Copy link

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests