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

insertNodes api causing uncertain behaviour. #3178

Open
hkkvo opened this issue May 7, 2024 · 3 comments
Open

insertNodes api causing uncertain behaviour. #3178

hkkvo opened this issue May 7, 2024 · 3 comments
Labels
bug Something isn't working needs reproduction

Comments

@hkkvo
Copy link

hkkvo commented May 7, 2024

Description

When custom plugin component is tried to insert using insertNodes Api, editor behaves in uncertain way to key press. In this case when i try to press enter after node insert in to palte editor. I'm getting exception but i try to insert same plugin element using insertEmptyElement Api. I'm not getting exception . Is there any solution to resolve this issue.

   insertNodes<TElement>(
    editor,
    {
      type: key,
      children: [
        
        {
          type: ELEMENT_TEXTAREA,
          children: [{ text: "Place Holder text" }],
        },
      ],
      ...props,
    },
    { at: path, select: true, nextBlock: true, ...(options as any) }
  );
2024-05-07.10-05-31.mp4
insertEmptyElement(editor, ELEMENT_TEXTAREA);
2024-05-07.10-06-06.mp4

Steps to Reproduce

Sandbox

Expected Behavior

Environment

  • slate:
  • slate-react:
  • browser: chrome

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
@hkkvo hkkvo added the bug Something isn't working label May 7, 2024
@hkkvo
Copy link
Author

hkkvo commented May 21, 2024

Any update on this.

@12joan
Copy link
Collaborator

12joan commented May 28, 2024

@hkkvo Please could you supply a full reproduction under the Sandbox heading in your issue?

@hkkvo
Copy link
Author

hkkvo commented May 29, 2024

Thank you for the response.

Things got resolved. Issue was happening because of the createExitBreakPlugin and not using createSoftBreakPlugin along with it. createExitBreakPlugin was interrupting the Enter key stroke and exiting current node block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs reproduction
Projects
None yet
Development

No branches or pull requests

2 participants