executeHandleTextAlign function
Applies text alignment to Paragraphs in the selection or to the Paragraph under the cursor.
Implementation
bool executeHandleTextAlign(FluentDocument document, String align) {
final cursor = document.cursor;
final selection = resolveSelectionFromCursor(document);
if (selection != null) {
for (final node in selection.nodes) {
_applyToParagraphs(document, node.container as FNode, align);
}
document.pendingTextAlign = align;
document.updateContent();
return true;
}
final container = document.findLogicalContainerCached(cursor.anchorId);
if (container != null) {
_applyToParagraphs(document, container as FNode, align);
document.pendingTextAlign = align;
document.updateContent();
return true;
}
return false;
}