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

fix: make TextAlign defaultAlignment setting work as expected #3460

Closed

Conversation

JosephASullivan
Copy link

Proposed fix to resolve #3459

@netlify
Copy link

netlify bot commented Nov 27, 2022

Deploy Preview for tiptap-embed failed.

Name Link
🔨 Latest commit b76a538
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/638304ef680d2f00099afde4

@JosephASullivan
Copy link
Author

Apologies -- I am new to pull requests and a bit confused. If someone could explain the automatic messages here and let me know what further action is needed from me, I'd greatly appreciate it.

@bdbch bdbch added Status: Review Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. labels Mar 29, 2023
Copy link

@Mohrip Mohrip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to modify

@@ -41,10 +41,6 @@ export const TextAlign = Extension.create<TextAlignOptions>({
default: this.options.defaultAlignment,
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
renderHTML: attributes => {
if (attributes.textAlign === this.options.defaultAlignment) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea here was to not add any style attributes to the element when the alignment is equal to the default alignment.

If we remove this, there's no way to get rid of alignment inline styles without removing a node first even though they are mostly not needed.

I think the only issue that could come up with this is, that the text alignment can diverge from the default because of a wrapping element that updates the text alignment and passes it down via inheritance but this is expected browser behaviour I'd say?

Open for discussion on this one.

@bdbch bdbch changed the base branch from main to develop November 30, 2024 07:57
@bdbch
Copy link
Member

bdbch commented Nov 30, 2024

Moved this to #5891

@bdbch bdbch closed this Nov 30, 2024
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange behavior of the defaultAlignment setting in the TextAlign extension
3 participants