How to use the prosemirror-gapcursor.GapCursor function in prosemirror-gapcursor

To help you get started, we’ve selected a few prosemirror-gapcursor 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 / packages / jest-prosemirror / src / jest-prosemirror-nodes.ts View on Github external
const { cursor, node, start, end, anchor, all, gap } = taggedDoc.tag;
  if (all) {
    return new AllSelection(taggedDoc);
  }

  if (node) {
    return new NodeSelection(taggedDoc.resolve(node));
  }

  if (cursor) {
    return new TextSelection(taggedDoc.resolve(cursor));
  }

  if (gap) {
    const $pos = taggedDoc.resolve(gap);
    return new GapCursor($pos, $pos);
  }

  if (start) {
    return createTextSelection({ taggedDoc, start, end });
  }

  const $anchor = resolveCell(taggedDoc, anchor);
  if ($anchor) {
    return Cast>(
      new CellSelection($anchor, resolveCell(taggedDoc, taggedDoc.tag.head) ?? undefined),
    );
  }
  return null;
};

prosemirror-gapcursor

ProseMirror plugin for cursors at normally impossible-to-reach positions

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Similar packages