Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
slate-history
Advanced tools
The slate-history package is a plugin for the Slate framework that provides undo and redo functionality. It allows developers to manage the history of changes made to the editor's content, enabling users to revert to previous states or redo changes that were undone.
Undo
This feature allows you to undo the last operation performed on the editor. The code sample demonstrates how to set up an editor with history and perform an undo operation.
const { Editor } = require('slate');
const { withHistory } = require('slate-history');
const editor = withHistory(new Editor());
// Perform some operations
editor.insertText('Hello, world!');
// Undo the last operation
editor.undo();
Redo
This feature allows you to redo the last undone operation. The code sample shows how to set up an editor with history, perform an undo operation, and then redo it.
const { Editor } = require('slate');
const { withHistory } = require('slate-history');
const editor = withHistory(new Editor());
// Perform some operations
editor.insertText('Hello, world!');
editor.undo();
// Redo the last undone operation
editor.redo();
Clear History
This feature allows you to clear the history of the editor. The code sample demonstrates how to set up an editor with history, perform an operation, and then clear the history.
const { Editor } = require('slate');
const { withHistory } = require('slate-history');
const editor = withHistory(new Editor());
// Perform some operations
editor.insertText('Hello, world!');
// Clear the history
editor.history = { undos: [], redos: [] };
Draft.js is a framework for building rich text editors in React. It provides built-in undo and redo functionality similar to slate-history, but it is more tightly integrated with React and offers a different API and set of features.
ProseMirror-history is a plugin for the ProseMirror editor that provides undo and redo functionality. It offers similar capabilities to slate-history but is designed to work with the ProseMirror framework, which has a different architecture and set of features compared to Slate.
Quill is a modern WYSIWYG editor built for compatibility and extensibility. It includes built-in undo and redo functionality and offers a different set of features and API compared to slate-history, focusing more on ease of use and extensibility.
This package contains the core logic of Slate. Feel free to poke around to learn more!
FAQs
An operation-based history implementation for Slate editors.
The npm package slate-history receives a total of 417,983 weekly downloads. As such, slate-history popularity was classified as popular.
We found that slate-history demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.