deleteSelectedContent function

void deleteSelectedContent(
  1. EditorState editorState
)

Implementation

void deleteSelectedContent(EditorState editorState) async {
  final selection = editorState.selection?.normalized;
  if (selection == null || selection.isCollapsed) {
    return;
  }
  final tb = editorState.transaction;
  await editorState.deleteSelection(selection);
  tb.afterSelection = Selection.collapsed(selection.start);
  editorState.apply(tb);
}