Socket
Socket
Sign inDemoInstall

prosemirror-view

Package Overview
Dependencies
Maintainers
1
Versions
280
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-view

ProseMirror's view component


Version published
Weekly downloads
1.7M
decreased by-2.01%
Maintainers
1
Weekly downloads
 
Created

What is prosemirror-view?

The prosemirror-view package is part of the ProseMirror ecosystem, which provides a toolkit for building rich-text editors. This particular package is responsible for rendering the document model into a DOM structure and handling user interactions. It allows developers to create custom views, handle input from users, and manage the editor's state.

What are prosemirror-view's main functionalities?

Rendering the document model

This code initializes an editor view in the body of the HTML document using a basic schema. It demonstrates how to render the document model into the DOM.

const {EditorView} = require('prosemirror-view');
const {EditorState} = require('prosemirror-state');
const {schema} = require('prosemirror-schema-basic');

let state = EditorState.create({schema});
let view = new EditorView(document.body, {state});

Handling user input

This code snippet shows how to listen for and handle key down events within the editor. It's a simple way to start building custom interactions.

view.setProps({
  handleKeyDown(view, event) {
    console.log('Key down:', event);
    return false; // Return true if the event was handled
  }
});

Custom node views

This demonstrates how to extend the NodeView class to create custom renderings for nodes in the document. It's a powerful feature for customizing the appearance and behavior of content.

const {NodeView} = require('prosemirror-view');

class CustomNodeView extends NodeView {
  // Implementation of a custom node view
}

Other packages similar to prosemirror-view

FAQs

Package last updated on 11 Jun 2024

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