Skip to content

Preserving <br> tags and copying and pasting selections #4786

@divporter

Description

@divporter

What we are attempting to achieve is retaining line breaks in the HTML that Quill produces without sacrificing other functionality.

Steps to Reproduce

  1. Add the following override to Quill
class BreakBlock extends Block {
  static tagName = 'DIV'
  html(): string {
    // This prevents <br /> tags from being removed when calling getSemanticHTML()
    return this.domNode.outerHTML
  }
}
Quill.register(BreakBlock, true)
  1. Add some text with multiple words to the editor (eg My text)
  2. Copy the word "My"
  3. Press enter to add a line break
  4. Paste

Expected behaviour

Content to look like

My text
My

Actual behaviour

Content looks like

My text
My text

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