@grafana/ui
Version:
Grafana Components Library
32 lines (27 loc) • 839 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var isHotkey = require('is-hotkey');
;
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