Affected Packages
extension-text-align
Version(s)
3.19.0
Bug Description
When using the TextAlign extension, every node of the specified types (e.g., paragraph, heading) gets a textAlign: null attribute in the JSON output, even if no alignment has been applied.
This behavior leads to bloated JSON data and can cause issues when synchronizing with databases or external systems that expect clean data structures. Ideally, the attribute should only be present if a non-default alignment is set.
Steps to reproduce:
- Install and configure @tiptap/extension-text-align with default settings.
- Create a simple paragraph without applying any alignment.
- Call editor.getJSON().
- Observe that the paragraph node contains "attrs": { "textAlign": null }
Browser Used
Chrome
Code Example URL
No response
Expected Behavior
The textAlign attribute should be omitted from the attrs object if its value is the default (null or left), similar to how other extensions handle default attributes.
Additional Context (Optional)
No response
Dependency Updates