facebook / facebook/lexical

Bug: Pasting text from the clipboard into a CustomElementNode does not work properly

Open
#6,477 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
57

Description

If you define a CustomElementNode class with isInline(): true and/or canBeEmpty(): true, then no text can be inserted from the clipboard. In this case, the text is inserted after the CustomElementNode. The same applies to adding DecoratorNodes. I assume that no nodes of any kind can be added to the CustomElementNode as a child.
But if isInline():false and canBeEmpty():false, then it works as expected.

Lexical version: 0.16.1

Link to code example:
https://stackblitz.com/edit/vitejs-vite-qmtgsj

## The current behavior
After inserting text from the clipboard (or adding a new node, such as a DecoratorNode) into the CustomElementNode, the text appears after the CustomElementNode

## The expected behavior
Text from clipboard (or new DecoratorNode) should added at current cursor position

## Impact of fix
HIGH
It affects all classes that extend from ElementNode and that may not be empty or are inline elements.

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.