Installations
npm install prosemirror-example-setup
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
20.13.1
NPM Version
10.8.0
Score
97.7
Supply Chain
99.6
Quality
76.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (94.03%)
CSS (5.97%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
4,324,300
Last Day
8,435
Last Week
51,647
Last Month
189,803
Last Year
1,254,228
GitHub Statistics
MIT License
148 Stars
138 Commits
113 Forks
11 Watchers
1 Branches
7 Contributors
Updated on Feb 06, 2025
Bundle Size
154.10 kB
Minified
48.15 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.2.3
Package Id
prosemirror-example-setup@1.2.3
Unpacked Size
90.09 kB
Size
20.42 kB
File Count
17
NPM Version
10.8.0
Node Version
20.13.1
Published on
Aug 16, 2024
Total Downloads
Cumulative downloads
Total Downloads
4,324,300
Last Day
0.1%
8,435
Compared to previous day
Last Week
8.3%
51,647
Compared to previous week
Last Month
49.8%
189,803
Compared to previous month
Last Year
23.1%
1,254,228
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
prosemirror-example-setup
[ WEBSITE | ISSUES | FORUM | GITTER ]
This is a non-core example module for ProseMirror. ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module provides an example of the glue code one might write to tie the modules that make up ProseMirror into an actual presentable editor. It is not meant to be very reusable, though it might be helpful to get something up-and-running quickly.
The project page has more information, a number of examples and the documentation.
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.
Documentation
This module exports helper functions for deriving a set of basic menu items, input rules, or key bindings from a schema. These values need to know about the schema for two reasons—they need access to specific instances of node and mark types, and they need to know which of the node and mark types that they know about are actually present in the schema.
-
exampleSetup
(options: Object) → Plugin[]
Create an array of plugins pre-configured for the given schema. The resulting array will include the following plugins:-
Input rules for smart quotes and creating the block types in the schema using markdown conventions (say
"> "
to create a blockquote) -
A keymap that defines keys to create and manipulate the nodes in the schema
-
A keymap binding the default keys provided by the prosemirror-commands module
-
The undo history plugin
-
The drop cursor plugin
-
The gap cursor plugin
-
A custom plugin that adds a
menuContent
prop for the prosemirror-menu wrapper, and a CSS class that enables the additional styling defined instyle/style.css
in this package
Probably only useful for quickly setting up a passable editor—you'll need more control over your settings in most real-world situations.
-
options
: Object
-
schema
: Schema
The schema to generate key bindings and menu items for. -
mapKeys
?: Object
Can be used to adjust the key bindings created. -
menuBar
?: boolean
Set to false to disable the menu bar. -
history
?: boolean
Set to false to disable the history plugin. -
floatingMenu
?: boolean
Set to false to make the menu bar non-floating. -
menuContent
?: MenuItem[][]
Can be used to override the menu content.
-
-
-
buildMenuItems
(schema: Schema) → {makeHead2?: MenuItem, makeHead3?: MenuItem, makeHead4?: MenuItem, makeHead5?: MenuItem, makeHead6?: MenuItem}
Given a schema, look for default mark and node types in it and return an object with relevant menu items relating to those marks.-
returns
: {makeHead2?: MenuItem, makeHead3?: MenuItem, makeHead4?: MenuItem, makeHead5?: MenuItem, makeHead6?: MenuItem}
-
toggleStrong
?: MenuItem
A menu item to toggle the strong mark. -
toggleEm
?: MenuItem
A menu item to toggle the emphasis mark. -
toggleCode
?: MenuItem
A menu item to toggle the code font mark. -
toggleLink
?: MenuItem
A menu item to toggle the link mark. -
insertImage
?: MenuItem
A menu item to insert an image. -
wrapBulletList
?: MenuItem
A menu item to wrap the selection in a bullet list. -
wrapOrderedList
?: MenuItem
A menu item to wrap the selection in an ordered list. -
wrapBlockQuote
?: MenuItem
A menu item to wrap the selection in a block quote. -
makeParagraph
?: MenuItem
A menu item to set the current textblock to be a normal paragraph. -
makeCodeBlock
?: MenuItem
A menu item to set the current textblock to be a code block. -
makeHead1
?: MenuItem
Menu items to set the current textblock to be a heading of level N. -
insertHorizontalRule
?: MenuItem
A menu item to insert a horizontal rule. -
insertMenu
: Dropdown
A dropdown containing theinsertImage
andinsertHorizontalRule
items. -
typeMenu
: Dropdown
A dropdown containing the items for making the current textblock a paragraph, code block, or heading. -
blockMenu
: MenuElement[][]
Array of block-related menu items. -
inlineMenu
: MenuElement[][]
Inline-markup related menu items. -
fullMenu
: MenuElement[][]
An array of arrays of menu elements for use as the full menu for, for example the menu bar.
-
-
-
buildKeymap
(schema: Schema, mapKeys: Object) → Object
Inspect the given schema looking for marks and nodes from the basic schema, and if found, add key bindings related to them. This will add:- Mod-b for toggling strong
- Mod-i for toggling emphasis
- Mod-` for toggling code font
- Ctrl-Shift-0 for making the current textblock a paragraph
- Ctrl-Shift-1 to Ctrl-Shift-Digit6 for making the current textblock a heading of the corresponding level
- Ctrl-Shift-Backslash to make the current textblock a code block
- Ctrl-Shift-8 to wrap the selection in an ordered list
- Ctrl-Shift-9 to wrap the selection in a bullet list
- Ctrl-> to wrap the selection in a block quote
- Enter to split a non-empty textblock in a list item while at the same time splitting the list item
- Mod-Enter to insert a hard break
- Mod-_ to insert a horizontal rule
- Backspace to undo an input rule
- Alt-ArrowUp to
joinUp
- Alt-ArrowDown to
joinDown
- Mod-BracketLeft to
lift
- Escape to
selectParentNode
You can suppress or map these bindings by passing a
mapKeys
argument, which maps key names (say"Mod-B"
to eitherfalse
, to remove the binding, or a new key name string. -
buildInputRules
(schema: Schema) → Plugin
A set of input rules for creating the basic block quotes, lists, code blocks, and heading.

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to prosemirror-example-setup
prosemirror-example-setup-abhinav
An example for how to set up a ProseMirror editor
@jimpick/prosemirror-example-setup
An example for how to set up a ProseMirror editor
prosemirror-example-setup-abhi
An example for how to set up a ProseMirror editor
@imal1/prosemirror-example-setup
An example for how to set up a ProseMirror editor