How to use the prosemirror-state.Selection.atEnd function in prosemirror-state

To help you get started, we’ve selected a few prosemirror-state examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
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);
  });
});
github nib-edit / Nib / packages / core / src / plugins / common / keymaps.js View on Github external
"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;
  }
});
github ifiokjr / remirror / @remirror / core-utils / src / prosemirror-utils.ts View on Github external
export const findNodeAtEndOfDoc = (doc: ProsemirrorNode) => findNodeAtPosition(PMSelection.atEnd(doc).$from);