UNPKG

@grafana/ui

Version:
32 lines (27 loc) 839 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isHotkey = require('is-hotkey'); "use strict"; const isSelectLineHotkey = isHotkey.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; } }; } exports.SelectionShortcutsPlugin = SelectionShortcutsPlugin; //# sourceMappingURL=selection_shortcuts.cjs.map