Skip to content

[Bug]: pasting text with multiple line-breaks crashes #5043

Description

@bastibuck

Bug type

Crash (process/app exits or hangs)

Browser surface

Yes

Summary

When using a maxLength constraint and pasting text longer than the constraint with multiple line-breaks in the overflowing text the app breaks.

Public reproduction URL

https://plate-playground-template-red.vercel.app/editor

Steps to reproduce

  1. Use reproduction URL and/or check commit)
  2. Paste text with 20+ chars where two line-breaks are after the cut-off of 20 (see example payloads in provided link)
  3. App crashes

Expected behavior

The app would not crash

Actual behavior

The app crashes with the below error message in console.

Uncaught TypeError: Cannot read properties of undefined (reading 'text')
Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Acceptance criteria

  • multiple linebreaks in pasted text do not break the app

Plate / Slate / React versions

plate: 53.2.1

Operating system

NOT_ENOUGH_INFO

Install method

No response

Framework / app setup

NOT_ENOUGH_INFO

Affected packages or entry points

NOT_ENOUGH_INFO

Minimal code or config excerpt

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions