@remirror/extension-image
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

@remirror/extension-image

Add images to your editor.

Version Weekly Downloads Bundled size Typed Codebase MIT License

Installation

yarn add @remirror/extension-image # yarn
pnpm add @remirror/extension-image # pnpm
npm install @remirror/extension-image # npm

This is included by default when you install the recommended remirror package. All exports are also available via the entry-point, remirror/extensions.

Usage

The following code sample will create a limited editor and run the available commands from this extension.

import { ExtensionPriority, RemirrorManager } from 'remirror';
import { CorePreset, ImageExtension } from 'remirror/extensions';

// Create the codeBlock extension
const imageExtension = new ImageExtension();
const corePreset = new CorePreset();

// Create the Editor Manager with the codeBlock extension passed through.
const manager = RemirrorManager.create([imageExtension, 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);

// Insert an image at the current selection.
manager.store.commands.insertImage({ src: `https://images.com/awesome.jpg` });

Package Sidebar

Install

npm i @remirror/extension-image

Weekly Downloads

44,477

Version

3.0.1

License

MIT

Unpacked Size

123 kB

Total Files

14

Last publish

Collaborators

  • ocavue
  • ifiokjr