@grafana/ui
Version:
Grafana Components Library
29 lines (25 loc) • 699 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
;
function ClearPlugin() {
return {
onKeyDown(event, editor, next) {
const value = editor.value;
if (value.selection.isExpanded) {
return next();
}
if (event.key === "k" && event.ctrlKey) {
event.preventDefault();
const text = value.anchorText.text;
const offset = value.selection.anchor.offset;
const length = text.length;
const forward = length - offset;
editor.deleteForward(forward);
return true;
}
return next();
}
};
}
exports.ClearPlugin = ClearPlugin;
//# sourceMappingURL=clear.cjs.map