[Bug]: Default value of text-align doesn't set any style on the element #5955
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-align
Version(s)
2.4.0
Bug Description
When using the Tiptap rich text editor, I encountered an issue where the
text-align
style is not added to the output for text elements aligned to the default alignment (right
in my case). This leads to a problem when the output is displayed on a page with a globaltext-align: center
style. The text, expected to align right, is instead centered because the necessarytext-align
style is missing.This issue still exist on the demo page. that's why I checked "Yes, I've updated all my dependencies."
Steps to Reproduce
right
.text-align: center
style.Browser Used
Chrome
Code Example URL
No response
Expected Behavior
The editor should add a
text-align
style explicitly to the output for right-aligned text, even ifright
is the default alignment. Alternatively, a solution that ensures no unintended alignment issues when the text is displayed elsewhere.Additional Context (Optional)
Suggested Solution
Add text-align: initial; to the CSS rules for default text alignment. This ensures that the text alignment property does not inherit global styles unintentionally.
By setting
text-align: initial;
, the text alignment falls back to the browser's default behavior unless explicitly overridden, providing a robust solution for scenarios with global alignment styles.Dependency Updates
The text was updated successfully, but these errors were encountered: