Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prosemirror-virtual-cursor

ocavue92.9kMIT0.4.2TypeScript support: included

NPM version

readme

prosemirror-virtual-cursor

NPM version

This is a plugin that adds a virtual cursor (or caret) to your editor. It implements Bike’s typing affinity caret, which shows a tail under the cursor between mark boundary.

https://user-images.githubusercontent.com/24715727/202461170-6df71a46-f0a5-492a-a61c-3db765dde389.mp4

Online Demo

Install

npm install prosemirror-virtual-cursor

Usage

import 'prosemirror-virtual-cursor/style/virtual-cursor.css';

import { createVirtualCursor } from 'prosemirror-virtual-cursor';

const plugin = createVirtualCursor();

Options

Cursor color

The default color of the cursor is red. You can change it by overriding the CSS variable --prosemirror-virtual-cursor-color. You can also copy all the CSS rules from style/virtual-cursor.css to your own stylesheet and change more things.

skipWarning

By default, prosemirror-virtual-cursor will warn you if any mark has inclusive set to false, as inclusive is not useful for prosemirror-virtual-cursor. You can disable this warning by setting skipWarning to true. You can also specify an array of mark names to skip the warning for specific marks.

const plugin = createVirtualCursor({ skipWarning: true });
const plugin = createVirtualCursor({ skipWarning: ['mark_type_name'] });

License

MIT

changelog

Changelog

0.4.2 (2023-12-18)

Bug Fixes

  • put the cursor at the start of the next line on Chrome (#28) (5384958)

0.4.1 (2023-08-14)

Bug Fixes

  • don't trigger ResizeObserver after view destroyed (#23) (8cfb11e)

0.4.0 (2023-08-06)

Features

  • warn for marks with inclusive as true (#19) (e67ddcf)

0.3.5 (2023-02-13)

Bug Fixes

  • add WebKit vendor prefix for user-select (#15) (37e2d8b), closes #14

0.3.4 (2022-12-19)

Bug Fixes

0.3.3 (2022-11-22)

Bug Fixes

  • only hide the native cursor if plugin enabled (5bbadc1)
  • only show the cursor when selection is empty (e38ea46)
  • only show the cursor when the editor is focused (66e56a9)

0.3.2 (2022-11-18)

Bug Fixes

0.3.1 (2022-11-18)

Bug Fixes

0.3.0 (2022-11-18)

Features

  • overlay the cursor over the editor (#7) (0c06bca)

0.2.0 (2022-11-18)

Features

  • use css variable to override cursor color (05204b4)

0.1.1 (2022-11-17)

Documentation

0.1.0 (2022-11-17)

Features