mirror of
https://github.com/facebook/lexical.git
synced 2025-05-17 23:26:16 +08:00
[lexical] Bug Fix : Prevent from adding element.style.textAlign when formatType is unset (#7536)
Co-authored-by: Baptiste Jamin <baptiste@crisp.chat>
This commit is contained in:
@ -173,11 +173,17 @@ export class ListItemNode extends ElementNode {
|
||||
|
||||
exportDOM(editor: LexicalEditor): DOMExportOutput {
|
||||
const element = this.createDOM(editor._config);
|
||||
element.style.textAlign = this.getFormatType();
|
||||
|
||||
const formatType = this.getFormatType();
|
||||
if (formatType) {
|
||||
element.style.textAlign = formatType;
|
||||
}
|
||||
|
||||
const direction = this.getDirection();
|
||||
if (direction) {
|
||||
element.dir = direction;
|
||||
}
|
||||
|
||||
return {
|
||||
element,
|
||||
};
|
||||
|
@ -159,7 +159,9 @@ export class QuoteNode extends ElementNode {
|
||||
}
|
||||
|
||||
const formatType = this.getFormatType();
|
||||
element.style.textAlign = formatType;
|
||||
if (formatType) {
|
||||
element.style.textAlign = formatType;
|
||||
}
|
||||
|
||||
const direction = this.getDirection();
|
||||
if (direction) {
|
||||
@ -320,7 +322,9 @@ export class HeadingNode extends ElementNode {
|
||||
}
|
||||
|
||||
const formatType = this.getFormatType();
|
||||
element.style.textAlign = formatType;
|
||||
if (formatType) {
|
||||
element.style.textAlign = formatType;
|
||||
}
|
||||
|
||||
const direction = this.getDirection();
|
||||
if (direction) {
|
||||
|
@ -90,7 +90,9 @@ export class ParagraphNode extends ElementNode {
|
||||
}
|
||||
|
||||
const formatType = this.getFormatType();
|
||||
element.style.textAlign = formatType;
|
||||
if (formatType) {
|
||||
element.style.textAlign = formatType;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user