Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('findNodeAtSelection', () => {
const selection = Selection.atEnd(pmDoc);
const { node, pos, start } = findNodeAtSelection(selection);
expect(node).toBe(expectedEnd);
expect(pos).toBe(16);
expect(start).toBe(17);
});
});
"Mod-a": (state, dispatch) => {
const textSelection = new TextSelection(
Selection.atStart(state.doc).$anchor,
Selection.atEnd(state.doc).$head
);
dispatch(state.tr.setSelection(textSelection));
return true;
}
});
export const findNodeAtEndOfDoc = (doc: ProsemirrorNode) => findNodeAtPosition(PMSelection.atEnd(doc).$from);