completeRemovalInteraction method

EditResult completeRemovalInteraction(
  1. Iterable<String> elementIds
)

Completes an erasure whose preview has only highlighted candidates. The controller must own an active interaction with unchanged document content.

Implementation

EditResult completeRemovalInteraction(Iterable<String> elementIds) {
  final ids = elementIds.toSet();
  final decision = removal(ids);
  if (!decision.allowed) {
    store.cancelInteraction();
    return decision;
  }
  final preview = store.internals.previewInteraction(
    DiagramTransaction(
      label: 'Erase elements',
      steps: [RemoveElementsStep(ids)],
    ),
  );
  if (!preview.allowed) {
    store.cancelInteraction();
    return preview;
  }
  return store.internals.commitInteraction();
}