mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-19 06:43:02 +08:00
fix: parse only available configured text-align values (#5169)
--------- Co-authored-by: volar <stanislav.volar@petitpress.sk> Co-authored-by: Nick Perez <nicholas.perez@tiptap.dev>
This commit is contained in:
parent
b5a7814446
commit
8d1af5fbe5
@ -63,7 +63,11 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
||||
attributes: {
|
||||
textAlign: {
|
||||
default: this.options.defaultAlignment,
|
||||
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
|
||||
parseHTML: element => {
|
||||
const alignment = element.style.textAlign || this.options.defaultAlignment
|
||||
|
||||
return this.options.alignments.includes(alignment) ? alignment : this.options.defaultAlignment
|
||||
},
|
||||
renderHTML: attributes => {
|
||||
if (attributes.textAlign === this.options.defaultAlignment) {
|
||||
return {}
|
||||
|
Loading…
Reference in New Issue
Block a user