executeHandleTab function

bool executeHandleTab(
  1. FluentDocument document, {
  2. bool shift = false,
})

Implementation

bool executeHandleTab(FluentDocument document, {bool shift = false}) {
  final cursor = document.cursor;

  final container = document.findLogicalContainerCached(cursor.anchorId);
  if (container == null) return true;

  final containerNode = container as FNode;
  final ancestorItem = findAncestorCached<ListItem>(document, containerNode);
  if (ancestorItem != null) {
    shift
        ? _handleListOutdent(document, ancestorItem)
        : _handleListIndent(document, ancestorItem);
    return true;
  }

  final ancestorCell = findAncestorCached<FluentCell>(document, containerNode);
  if (ancestorCell != null) {
    shift
        ? _handleTablePreviousCell(document, ancestorCell)
        : _handleTableNextCell(document, ancestorCell);
    return true;
  }

  if (container is Paragraph) {
    shift
        ? _handleParagraphOutdent(document, container)
        : _handleParagraphIndent(document, container);
    return true;
  }

  return true;
}