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

Global styles get removed when destroying editor even if there are other editors alive #2143

Closed
1 of 2 tasks
pie6k opened this issue Nov 8, 2021 · 1 comment
Closed
1 of 2 tasks
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@pie6k
Copy link

pie6k commented Nov 8, 2021

What’s the bug you are facing?

Global styles (https://github.com/ueberdosis/tiptap/blob/main/packages/core/src/style.ts) are added to <head> when editor is created and removed when editor is destroyed.

This works fine if using only one editor on the page.

However, if using multiple editors, if one of them is removed, but others are still alive - those styles are still removed causing slight layout changes.

Thus I think there should be some sort of global counter that counts remaining alive instances and removes the styles only if there are no alive editors left.

How can we reproduce the bug on our side?

Create 2 react editors.

Perform react update that removes one of them.

Expected result: global styles are still present
Actual result <style data-tiptap-style> tag is removed from head.

Can you provide a CodeSandbox?

No response

What did you expect to happen?

Have global styles alive as long as any editor instance is running

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. 💖
@pie6k pie6k added the Type: Bug The issue or pullrequest is related to a bug label Nov 8, 2021
@pie6k pie6k changed the title Global styles get removed even if they should not be if using multiple editor on the same page Global styles get removed when destroying editor even if there are other editors alive Nov 8, 2021
@philippkuehn
Copy link
Contributor

Ah yes, I think this issue is related to #2120

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

2 participants