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

unsetAllMarks and clearNodes command issue when all content is selected #2491

Closed
1 of 2 tasks
cooliopas opened this issue Feb 6, 2022 · 0 comments
Closed
1 of 2 tasks
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@cooliopas
Copy link

What’s the bug you are facing?

I have a Clear Format button on my toolbar, to run this command:
editor.chain().focus().clearNodes().unsetAllMarks().run()

It works always fine, but when user has all content on editor selected (ctrl/cmd + A).
If all content is selected and we run clearNodes() or unsetAllMarks(), the command runs and selection is cleared, so the next command can NOT be applied.

On the following video, the last 4 buttons have the following commands:

editor.chain().focus().clearNodes().unsetAllMarks().run()
editor.chain().focus().clearNodes().run()
editor.chain().focus().unsetAllMarks().run()
editor.chain().focus().unsetAllMarks().clearNodes().run()
Screen.Recording.2022-02-06.at.13.58.15.mov

Notice the issues when all content is selected, and also notice how everything works as expected when selecting all content BUT the last character.

How can we reproduce the bug on our side?

On https://tiptap.dev/examples/default you can select all content and click clear marks or clear nodes to confirm current selection gets lost.

Can you provide a CodeSandbox?

No response

What did you expect to happen?

I expect both commands get applied on current selection, and selection to be kept after transform.

Anything to add? (optional)

No response

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. 💖
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