plate icon indicating copy to clipboard operation
plate copied to clipboard

Select half of the image then delete (backspace) broke editor

Open ngoctu-bic opened this issue 1 year ago • 3 comments

Description

Steps to Reproduce

  1. Select a text below the image
  2. Move cursor so that select half of the image (not trigger image selected state)
  3. Press backspace

https://github.com/udecode/plate/assets/129946813/e821d29c-1c21-4a37-a036-2fb3fff14675

Sandbox

This could be reproduce using demo editor on platejs.org

Expected Behavior

TBD

Environment

  • slate: 0.94.1
  • slate-react: 0.99.0
  • browser: chrome 120.0.6099.216

Bounty

Click here to add a bounty via Algora.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

ngoctu-bic avatar Jan 16 '24 01:01 ngoctu-bic

The selection may have some wrong which look like a point should be a range, Is there someone give me some advice to fix it?

Zum-Gluck avatar Jan 22 '24 01:01 Zum-Gluck

This is a bug in slate-react. Related issues: https://github.com/ianstormtaylor/slate/issues/5435, https://github.com/ianstormtaylor/slate/pull/5451.

The error occurs inside toSlatePoint, where the anchorNode has been passed in from toSlateRange as a span HTMLElement instead of a Text node.

12joan avatar Jan 22 '24 08:01 12joan

Same issue. It also happens when you select text and also an image until the drag handles show up. How can I prevent it from crashing the page?

xHati44 avatar Feb 04 '24 03:02 xHati44