When text align is default, don't add a style attribute
This commit is contained in:
@@ -37,9 +37,13 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
|||||||
attributes: {
|
attributes: {
|
||||||
textAlign: {
|
textAlign: {
|
||||||
default: this.options.defaultAlignment,
|
default: this.options.defaultAlignment,
|
||||||
renderHTML: attributes => ({
|
renderHTML: attributes => {
|
||||||
style: `text-align: ${attributes.textAlign}`,
|
if (attributes.textAlign == this.options.defaultAlignment){
|
||||||
}),
|
return {}
|
||||||
|
} else {
|
||||||
|
return { style: `text-align: ${attributes.textAlign}` }
|
||||||
|
}
|
||||||
|
},
|
||||||
parseHTML: element => ({
|
parseHTML: element => ({
|
||||||
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user