Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-resizable-view

Package Overview
Dependencies
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-resizable-view

A ProseMirror node view that make your node resizable

  • 0.0.0-pr1801.3
  • pr1801
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

prosemirror-resizable-view

A ProseMirror node view that make your node resizable

Version Weekly Downloads Bundled size Typed Codebase MIT License

Installation

# yarn
yarn add prosemirror-resizable-view

# pnpm
pnpm add prosemirror-resizable-view

# npm
npm install prosemirror-resizable-view

Usage

The following code creates an resizable image node view.

import { ResizableNodeView } from 'prosemirror-resizable-view';

const createInnerImage = ({ node }: { node: ProsemirrorNode }) => {
  const inner = document.createElement('img');
  inner.setAttribute('src', node.attrs.src);
  inner.style.width = '100%';
  inner.style.minWidth = '50px';
  inner.style.objectFit = 'contain'; // maintain image's aspect ratio
  return inner;
};

/**
 * ResizableImageView is a NodeView for image. You can resize the image by
 * dragging the handle over the image.
 */
export class ResizableImageView extends ResizableNodeView implements NodeView {
  constructor(node: ProsemirrorNode, view: EditorView, getPos: () => number) {
    super({ node, view, getPos, createElement: createInnerImage });
  }
}

Keywords

FAQs

Package last updated on 01 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc