What is prosemirror-history?
The prosemirror-history package is a module for ProseMirror, a toolkit for building rich-text editors. This package specifically provides functionality for undo and redo actions within the editor's history. It is essential for implementing non-linear history and tracking changes in the document state over time.
What are prosemirror-history's main functionalities?
Undo Functionality
This feature allows users to undo the last change made to the editor's document. The 'undo' function is used in conjunction with the 'history' plugin, which must be added to the editor's state configuration.
import { undo, history } from 'prosemirror-history';
const myEditorState = EditorState.create({
plugins: [
history()
]
});
// To undo the last change
undo(myEditorState);
Redo Functionality
This feature enables users to redo changes that were previously undone using the undo function. Similar to undo, the 'redo' function requires the 'history' plugin to be present in the editor's configuration.
import { redo, history } from 'prosemirror-history';
const myEditorState = EditorState.create({
plugins: [
history()
]
});
// To redo the last undone change
redo(myEditorState);
Other packages similar to prosemirror-history
yjs
Yjs is a real-time collaborative framework that supports shared editing of rich-text documents. Unlike prosemirror-history, which focuses on undo and redo capabilities, Yjs provides a comprehensive approach to real-time collaboration, including conflict resolution and offline editing capabilities.
ckeditor5-undo
CKEditor 5's undo feature is part of the CKEditor rich-text editor framework. It provides similar undo and redo functionalities as prosemirror-history but is tightly integrated within the CKEditor ecosystem, making it less modular compared to the standalone prosemirror-history package.
prosemirror-history
[ 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 an
undo/redo history plugin for ProseMirror.
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.