Fix unwanted br alignment reset
This commit is contained in:
@@ -1104,11 +1104,15 @@ void XMLCALL ChapterHtmlSlimParser::endElement(void* userData, const XML_Char* n
|
|||||||
// Margins/padding are preserved so parent element spacing still accumulates correctly.
|
// Margins/padding are preserved so parent element spacing still accumulates correctly.
|
||||||
if (self->currentTextBlock && self->currentTextBlock->isEmpty()) {
|
if (self->currentTextBlock && self->currentTextBlock->isEmpty()) {
|
||||||
auto style = self->currentTextBlock->getBlockStyle();
|
auto style = self->currentTextBlock->getBlockStyle();
|
||||||
style.textAlignDefined = false;
|
// Keep alignment for synthetic empty <br> separator blocks so following inline
|
||||||
style.alignment = (self->paragraphAlignment == static_cast<uint8_t>(CssTextAlign::None))
|
// text after <br/> inside centered/right-aligned containers preserves alignment.
|
||||||
? CssTextAlign::Justify
|
if (!style.fromBrElement) {
|
||||||
: static_cast<CssTextAlign>(self->paragraphAlignment);
|
style.textAlignDefined = false;
|
||||||
self->currentTextBlock->setBlockStyle(style);
|
style.alignment = (self->paragraphAlignment == static_cast<uint8_t>(CssTextAlign::None))
|
||||||
|
? CssTextAlign::Justify
|
||||||
|
: static_cast<CssTextAlign>(self->paragraphAlignment);
|
||||||
|
self->currentTextBlock->setBlockStyle(style);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user