Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0-beta.133 insertContentAt change is causing bug when inserting nodes into empty paragraphs #2156

Closed
1 of 2 tasks
Demivan opened this issue Nov 10, 2021 · 0 comments
Closed
1 of 2 tasks
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@Demivan
Copy link

Demivan commented Nov 10, 2021

What’s the bug you are facing?

When I try to insert nodes using insertContent into empty paragrapt only first one is inserted. Inserting next node replaces existing one.

How can we reproduce the bug on our side?

Reproduction in CodeSandbox.

  1. Click "Insert Emoji"
  2. First time - emoji is inserted
  3. Next time - existing emoij is replaced

If you type something in the editor before clicking "Insert Emoji" it works as expected

Can you provide a CodeSandbox?

https://codesandbox.io/s/2-0-0-beta-137-o7qxh 2.0.0-beta.137 - broken
https://codesandbox.io/s/2-0-0-beta-132-kc79f 2.0.0-beta.132 - correct

What did you expect to happen?

Calling insertContent should insert content instead of replacing existing content

Anything to add? (optional)

Looks like isOnlyBlockContent is incorrect and does not check for content inside block nodes

let isOnlyBlockContent = true
content.forEach(node => {
isOnlyBlockContent = isOnlyBlockContent
? node.isBlock
: false
})

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@Demivan Demivan added the Type: Bug The issue or pullrequest is related to a bug label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant