@remirror/extension-drop-cursor
Version:
A cursor for the ages. Drag and drop content in your editor with class.
48 lines (34 loc) • 2.01 kB
Markdown
> A cursor for the ages. Drag and drop content in your editor with class.
[![Version][version]][npm] [![Weekly Downloads][downloads-badge]][npm] [![Bundled size][size-badge]][size] [![Typed Codebase][typescript]](
[]: https://flat.badgen.net/npm/v/@remirror/extension-drop-cursor
[]: https://npmjs.com/package/@remirror/extension-drop-cursor
[]: https://flat.badgen.net/badge/license/MIT/purple
[]: https://bundlephobia.com/result?p=@remirror/extension-drop-cursor
[]: https://flat.badgen.net/bundlephobia/minzip/@remirror/extension-drop-cursor
[]: https://flat.badgen.net/badge/icon/TypeScript?icon=typescript&label
[]: https://badgen.net/npm/dw/@remirror/extension-drop-cursor/red?icon=npm
```bash
yarn add @remirror/extension-drop-cursor
pnpm add @remirror/extension-drop-cursor
npm install @remirror/extension-drop-cursor
```
This is included by default when you install the recommended `remirror` package. All exports are also available via the entry-point, `remirror/extensions`.
The following code sample will create a limited editor and run the available commands from this extension.
```ts
import { ExtensionPriority, RemirrorManager } from 'remirror';
import { CorePreset, DropCursorExtension } from 'remirror/extensions';
// Create the codeBlock extension
const dropCursorExtension = new DropCursorExtension({ supportedLanguages: [typescript, jsx] });
const corePreset = new CorePreset();
// Create the Editor Manager with the codeBlock extension passed through.
const manager = RemirrorManager.create([dropCursorExtension, corePreset]);
// Pass the dom element to the editor. If you are using `@remirror/react` or
// other framework wrappers then this is handled for you.
const element = document.createElement('div');
document.body.append(element);
// Add the view to the editor manager.
manager.addView(element);
```