executeHandleTab function
Implementation
bool executeHandleTab(FluentDocument document, {bool shift = false}) {
final root = document.content;
final cursor = document.cursor;
// Find the current cursor container
final container = findLogicalContainer(root, cursor.anchorId);
if (container == null) return true;
// Climb up to find ListItem/Cell ancestor (with the new structure the
// returned container is the inner Paragraph, not the ListItem/Cell).
final containerNode = container as FNode;
final ancestorItem = _findAncestor<ListItem>(root, containerNode);
if (ancestorItem != null) {
shift
? _handleListOutdent(document, ancestorItem)
: _handleListIndent(document, ancestorItem);
return true;
}
final ancestorCell = _findAncestor<FluentCell>(root, containerNode);
if (ancestorCell != null) {
shift
? _handleTablePreviousCell(document, ancestorCell)
: _handleTableNextCell(document, ancestorCell);
return true;
}
// Normal paragraphs: handle indent/outdent
if (container is Paragraph) {
shift
? _handleParagraphOutdent(document, container)
: _handleParagraphIndent(document, container);
return true;
}
return true;
}