Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
prosemirror-commands
Advanced tools
The prosemirror-commands package provides a set of predefined commands for manipulating the content of a ProseMirror editor. These commands cover a wide range of common editing actions, such as formatting text, inserting nodes, and manipulating the document structure.
Text Formatting
This feature allows you to toggle text formatting such as bold, italic, and underline. The code sample demonstrates how to create a command to toggle bold formatting using the ProseMirror schema.
const { toggleMark } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to toggle bold formatting
const toggleBold = toggleMark(schema.marks.strong);
Node Insertion
This feature allows you to insert or change the type of nodes in the document. The code sample shows how to create a command to set a block type to a paragraph.
const { setBlockType } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to set a paragraph block type
const setParagraph = setBlockType(schema.nodes.paragraph);
Document Manipulation
This feature provides commands for manipulating the document structure, such as joining blocks or splitting nodes. The code sample demonstrates how to create a command to join the current block with the one above it.
const { joinUp } = require('prosemirror-commands');
// Example command to join the current block with the one above it
const joinWithAbove = joinUp;
Tiptap is a headless, framework-agnostic text editor built on top of ProseMirror. It provides a more modern and flexible API for creating rich text editors. Compared to prosemirror-commands, Tiptap offers a higher-level abstraction and additional features like collaborative editing and real-time collaboration.
Slate is a completely customizable framework for building rich text editors. It provides a more flexible and extensible API compared to prosemirror-commands, allowing developers to define their own commands and behaviors. Slate is known for its ease of use and powerful plugin system.
Draft.js is a rich text editor framework developed by Facebook. It provides a set of immutable models and helper functions for building rich text editors. While it offers similar functionalities to prosemirror-commands, Draft.js is more opinionated and tightly integrated with React.
[ WEBSITE | ISSUES | FORUM | GITTER | CHANGELOG ]
ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module implements a number of editing commands, which are functions that abstract editing actions which can be bound to keys.
The project page has more information, a number of demos and the documentation.
NOTE: This project is in BETA stage. It isn't thoroughly tested,
and the API might still change across 0.x
releases. You are welcome
to use it, but don't expect it to be very stable yet.
This code is released under an MIT license. There's a forum for general discussion and support requests, and the Github bug tracker is the place to report issues.
0.13.0 (2016-11-11)
The autoJoin
function allows you to wrap command functions so that when the command makes nodes of a certain type occur next to each other, they are automatically joined.
FAQs
Editing commands for ProseMirror
The npm package prosemirror-commands receives a total of 1,257,997 weekly downloads. As such, prosemirror-commands popularity was classified as popular.
We found that prosemirror-commands demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.