mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 11:49:02 +08:00
When text align is default, don't add a style attribute
This commit is contained in:
parent
3e14f24ef5
commit
5bb499eba8
@ -37,9 +37,13 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
||||
attributes: {
|
||||
textAlign: {
|
||||
default: this.options.defaultAlignment,
|
||||
renderHTML: attributes => ({
|
||||
style: `text-align: ${attributes.textAlign}`,
|
||||
}),
|
||||
renderHTML: attributes => {
|
||||
if (attributes.textAlign == this.options.defaultAlignment){
|
||||
return {}
|
||||
} else {
|
||||
return { style: `text-align: ${attributes.textAlign}` }
|
||||
}
|
||||
},
|
||||
parseHTML: element => ({
|
||||
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user