[Bug]: TextStyle extension renders inherited styles as inline #6102
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
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
The text was updated successfully, but these errors were encountered: