deleteSelectionIfExists function

bool deleteSelectionIfExists(
  1. FluentDocument document
)

If there's an active selection, deletes it by replacing with empty string. Returns true if a selection was deleted, false otherwise.

Implementation

bool deleteSelectionIfExists(FluentDocument document) {
  final selection = resolveSelectionFromCursor(document);
  if (selection != null) {
    executeHandleReplaceSelection('', document);
    return true;
  }
  return false;
}