toggleInteractionModeWhenCmdOrCtrlPressed function

ExecutionInstruction toggleInteractionModeWhenCmdOrCtrlPressed({
  1. required EditContext editContext,
  2. required KeyEvent keyEvent,
})

Implementation

ExecutionInstruction toggleInteractionModeWhenCmdOrCtrlPressed({
  required EditContext editContext,
  required KeyEvent keyEvent,
}) {
  if (keyEvent.isPrimaryShortcutKeyPressed && !editContext.composer.isInInteractionMode.value) {
    editorKeyLog.fine("Activating editor interaction mode");
    editContext.composer.isInInteractionMode.value = true;
  } else if (editContext.composer.isInInteractionMode.value) {
    editorKeyLog.fine("De-activating editor interaction mode");
    editContext.composer.isInInteractionMode.value = false;
  }

  return ExecutionInstruction.continueExecution;
}