facebook / facebook/lexical

Bug: Image paste doesn't respect caret position

Open
#4,177 3 comments 0 reactions 0 assignees View on GitHub
all-platforms-bug copy+paste images
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

When there are multiple Image Nodes consecutively, pasting an cutting and pasting an image pastes it at the wrong location. I suspect this issue is happening for nodes which implement `decorate`.

Lexical version: 0.9.0

## Steps To Reproduce

1. Insert three distinct images consecutively (with no spaces in between)
2. Move your cursor after the last image
3. Use `Shift + Left Arrow` to select the last image
4. Use `Cmd / Ctrl + X` to cut and `Cmd / Ctrl + V` to paste at same location

Link to code example: This issue occurs in playground.

## The current behavior

Image is pasted between first and second images

## The expected behavior

Image is pasted after the second image

https://user-images.githubusercontent.com/13694315/226834392-97cb6df0-60b4-49e9-9d2a-bf45fcef6351.mp4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.