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

The mention plugin does not select a user and press esc to exist, then pressing ctrl+z to cancel will cause the system to crash. #3103

Closed
natamox opened this issue Apr 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@natamox
Copy link
Collaborator

natamox commented Apr 5, 2024

Description

The same as press left or right when not select user.

Steps to Reproduce

1712302404540-20240405_152639.mp4

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
@natamox natamox added the bug Something isn't working label Apr 5, 2024
@natamox
Copy link
Collaborator Author

natamox commented Apr 5, 2024

I tried to fix it and by following code

export const removeMentionInput = <V extends Value>(
  editor: PlateEditor<V>,
  path: Path
) =>
  withoutNormalizing(editor, () => {
    const node = getNode<TMentionInputElement>(editor, path);
    if (!node) return;

    const { trigger } = node;

    removeNodes(editor, {
      at: path,
    });

    insertText(editor, `${trigger}${node.children?.at(0)?.text}`, {
      at: path,
    });
  });

But other weird things happened

  1. After pressing esc, the mouse cursor is in front,
  2. When undoing it until the content is empty, an error will be reported on the console, but it will not affect the normal progress of the program. After tracing the code, I found that the problem is here, but I don't know what problem this will cause.
1712305603423-20240405_162543.mp4

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

No branches or pull requests

1 participant