Skip to content

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

@kravemir

Description

@kravemir

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions