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

[Bug]: TextStyle extension renders inherited styles as inline #6102

Open
1 task done
SionGrey opened this issue Feb 13, 2025 · 0 comments
Open
1 task done

[Bug]: TextStyle extension renders inherited styles as inline #6102

SionGrey opened this issue Feb 13, 2025 · 0 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@SionGrey
Copy link

Affected Packages

extension-text-style

Version(s)

2.7.0

Bug Description

So, maybe it is not a bug, but some kind of misused feature, but when you paste text into editor instance with TextStyle (and extended variants like color and font-family extensions), text got wrapped in span with inline style attributes with values from inherited styles. Like, paste text in font-family demo (https://tiptap.dev/docs/editor/extensions/functionality/fontfamily) and it will render text with inline style="font-family: "Segoe UI", "Helvetica Neue", Helvetica, Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", sans-serif"
Same happens with color demo (https://tiptap.dev/docs/editor/extensions/functionality/color) - style="color: rgb(22, 29, 29)"
And very long inherited style on general TextStyle
Reason is - somehow pated text got wrapped in spans, and then in method addGlobalAttributes function parseHTML: (element) => element.style for some reason returns not expected empty inline style, but whole inherited style object from browser and css applied styles

Reproduction is 100% when pasting text, copied from browser to any of mentioned above demos

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

No wrapping of pasted text in spans with generated inline styles. Wrapping in spans maybe ok, but generated inline styles - definitely not

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@SionGrey SionGrey added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant