Skip to content

Inline styles do not persist when using Shift+Enter #1672

Open
@screenspaceio

Description

@screenspaceio

When pressing Shift+Enter within a block that has inline styles applied (either custom or default), the style does not carry over to the new line. Instead, the new line starts with no styling. The expected behavior is for the inline style to persist into the new line, allowing consistent formatting across line breaks as it does when pressing "Enter".

To Reproduce

  1. Type a sentence and change the text to red
  2. Place the cursor anywhere in the text and type Shift+Enter
  3. Start typing - the new text is white, not red.

Intended behavior: Run these steps again and press Enter instead. This is the intended behavior, as the color persists into the new block.

You can see this behavior on the live examples in the BlockNote docs.

Original Block:

[
  {
    "id": "123",
    "type": "paragraph",
    "props": {},
    "content": [
      {
        "type": "text",
        "text": "This is red",
        "styles": {
          "textColor": "red" <-- COPY STYLES
        }
      }
    ],
  }
]

After Shift+Enter Pressed:

[
  {
    "id": "123",
    "type": "paragraph",
    "props": {},
    "content": [
      {
        "type": "text",
        "text": "This is red\n",
        "styles": {
          "textColor": "red"
        },
       {
        "type": "text",
        "text": "Now it's white",
        "styles": {}  <-- EMPTY (Should have textColor copied)
      }
      }
    ],
  }
]

Browser: Arc

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions