Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handle = function (event: KeyboardEvent, editor: Editor, actions: TableActions, lazyWire) {
if (event.keyCode === VK.TAB) {
const body = Util.getBody(editor);
const isRoot = function (element) {
const name = Node.name(element);
return Compare.eq(element, body) || Arr.contains(rootElements, name);
};
const rng = editor.selection.getRng();
if (rng.collapsed) {
const start = Element.fromDom(rng.startContainer);
TableLookup.cell(start, isRoot).each(function (cell) {
event.preventDefault();
const navigation: any = event.shiftKey ? backward : forward;
const rng = navigation(editor, isRoot, cell, actions, lazyWire);
rng.each(function (range) {
editor.selection.setRng(range);
});
});
}
}
};