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

@tiptap/pm

Package Overview
Dependencies
Maintainers
5
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/pm

prosemirror wrapper package for tiptap

  • 2.5.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
decreased by-0.95%
Maintainers
5
Weekly downloads
 
Created

What is @tiptap/pm?

@tiptap/pm is a package that provides a set of tools and utilities for building rich text editors. It is part of the Tiptap ecosystem, which is built on top of ProseMirror, a toolkit for building rich text editors. @tiptap/pm offers a range of functionalities including schema creation, commands, input rules, and more.

What are @tiptap/pm's main functionalities?

Schema Creation

This feature allows you to define the structure of your document. The schema defines the nodes and marks that can be used in the editor.

const { Schema } = require('@tiptap/pm');

const mySchema = new Schema({
  nodes: {
    doc: { content: 'block+' },
    paragraph: { content: 'text*', toDOM: () => ['p', 0], parseDOM: [{ tag: 'p' }] },
    text: { inline: true }
  },
  marks: {}
});

Commands

Commands are functions that perform actions on the editor state. This example shows how to create a command to toggle a bold mark.

const { toggleMark } = require('@tiptap/pm');

const boldCommand = toggleMark(mySchema.marks.bold);

// Usage in an editor instance
editor.commands.bold = () => boldCommand(editor.state, editor.dispatch);

Input Rules

Input rules are used to automatically transform text as the user types. This example shows how to create an input rule that transforms text starting with '>' into a blockquote.

const { inputRules, wrappingInputRule } = require('@tiptap/pm');

const blockquoteRule = wrappingInputRule(/^
*>
$/, mySchema.nodes.blockquote);

const myInputRules = inputRules({ rules: [blockquoteRule] });

Other packages similar to @tiptap/pm

Keywords

FAQs

Package last updated on 30 Jul 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