refactor: change sort of code

This commit is contained in:
Philipp Kühn
2021-05-11 17:15:23 +02:00
parent 592ea65f8b
commit d3b704f25f

View File

@@ -37,6 +37,9 @@ export const TextAlign = Extension.create<TextAlignOptions>({
attributes: { attributes: {
textAlign: { textAlign: {
default: this.options.defaultAlignment, default: this.options.defaultAlignment,
parseHTML: element => ({
textAlign: element.style.textAlign || this.options.defaultAlignment,
}),
renderHTML: attributes => { renderHTML: attributes => {
if (attributes.textAlign === this.options.defaultAlignment) { if (attributes.textAlign === this.options.defaultAlignment) {
return {} return {}
@@ -44,9 +47,6 @@ export const TextAlign = Extension.create<TextAlignOptions>({
return { style: `text-align: ${attributes.textAlign}` } return { style: `text-align: ${attributes.textAlign}` }
}, },
parseHTML: element => ({
textAlign: element.style.textAlign || this.options.defaultAlignment,
}),
}, },
}, },
}, },