defaultImeKeyboardActions top-level property
Keyboard actions for a SuperEditor running with IME on desktop.
Using the IME on desktop involves partial input from the IME and partial input from non-content keys, like arrow keys.
Implementation
final defaultImeKeyboardActions = <SuperEditorKeyboardAction>[
toggleInteractionModeWhenCmdOrCtrlPressed,
pasteWhenCmdVIsPressed,
copyWhenCmdCIsPressed,
cutWhenCmdXIsPressed,
undoWhenCmdZOrCtrlZIsPressed,
redoWhenCmdShiftZOrCtrlShiftZIsPressed,
selectAllWhenCmdAIsPressed,
cmdBToToggleBold,
cmdIToToggleItalics,
// All handlers that use backspace should be placed before `doNothingWithBackspaceOnWeb`,
// otherwise they will not run on web.
backspaceToUnIndentListItem,
backspaceToUnIndentParagraph,
backspaceToUnIndentTask,
backspaceToConvertTaskToParagraph,
backspaceToClearParagraphBlockType,
// We handled all shortcuts that care about backspace. Let the browser IME handle the
// backspace to perform text deletion.
doNothingWithBackspaceOnWeb,
doNothingWithCtrlOrCmdAndZOnWeb,
tabToIndentTask,
shiftTabToUnIndentTask,
tabToIndentParagraph,
shiftTabToUnIndentParagraph,
enterToUnIndentParagraph,
deleteDownstreamCharacterWithCtrlDeleteOnMac,
scrollOnCtrlOrCmdAndHomeKeyPress,
scrollOnCtrlOrCmdAndEndKeyPress,
shiftEnterToInsertNewlineInBlock,
deleteToEndOfLineWithCmdDeleteOnMac,
// WARNING: No keyboard handlers below this point will run on Mac. On Mac, most
// common shortcuts are recognized by the OS. This line short circuits Super Editor
// handlers, passing the key combo to the OS on Mac. Place all custom Mac key
// combos above this handler.
sendKeyEventToMacOs,
doNothingWhenThereIsNoSelection,
scrollOnPageUpKeyPress,
scrollOnPageDownKeyPress,
moveUpAndDownWithArrowKeys,
moveToStartOrEndOfLineWithArrowKeysOnWeb,
doNothingWithLeftRightArrowKeysAtMiddleOfTextOnWeb,
moveLeftAndRightWithArrowKeys,
moveToLineStartWithHome,
moveToLineEndWithEnd,
doNothingWithEnterOnWeb,
enterToInsertNewTask,
enterToInsertBlockNewline,
tabToIndentListItem,
shiftTabToUnIndentListItem,
deleteToStartOfLineWithCmdBackspaceOnMac,
deleteWordUpstreamWithAltBackspaceOnMac,
deleteWordUpstreamWithControlBackspaceOnWindowsAndLinux,
deleteUpstreamContentWithBackspace,
deleteWordDownstreamWithAltDeleteOnMac,
deleteWordDownstreamWithControlDeleteOnWindowsAndLinux,
doNothingWithDeleteOnWeb,
deleteDownstreamContentWithDelete,
];