UNPKG

@grafana/ui

Version:
28 lines (25 loc) 731 B
import { isKeyHotkey } from 'is-hotkey'; "use strict"; const isSelectLineHotkey = isKeyHotkey("mod+l"); function SelectionShortcutsPlugin() { return { onKeyDown(event, editor, next) { if (isSelectLineHotkey(event)) { event.preventDefault(); const { focusBlock, document } = editor.value; editor.moveAnchorToStartOfBlock(); const nextBlock = document.getNextBlock(focusBlock.key); if (nextBlock) { editor.moveFocusToStartOfNextBlock(); } else { editor.moveFocusToEndOfText(); } } else { return next(); } return true; } }; } export { SelectionShortcutsPlugin }; //# sourceMappingURL=selection_shortcuts.mjs.map