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

3.0.1 • Public • Published

@remirror/extension-positioner

Reposition your elements with every state update.

Version Weekly Downloads Bundled size Typed Codebase MIT License

Installation

# yarn
yarn add @remirror/extension-positioner

# pnpm
pnpm add @remirror/extension-positioner

# npm
npm install @remirror/extension-positioner

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

Usage

An extension for tracking the position of the provided element relative to the prosemirror editor. Can be used to find the top / left position in order to position the element as a hover menu.

import { PositionerExtension } from 'remirror/extensions';

const extension = new PositionerExtension();

const dispose = extension.addCustomHandler({
  positioner: 'bubble',
  element,
  onChange: ({ isActive, top, left }) => {
    // do something
  },
});

// Later in the app
dispose(); // Remove the positioner.

/@remirror/extension-positioner/

    Package Sidebar

    Install

    npm i @remirror/extension-positioner

    Weekly Downloads

    35,444

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    218 kB

    Total Files

    16

    Last publish

    Collaborators

    • ocavue
    • ifiokjr