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

slate-history

Package Overview
Dependencies
Maintainers
5
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slate-history

An operation-based history implementation for Slate editors.

  • 0.110.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
561K
increased by4.32%
Maintainers
5
Weekly downloads
 
Created

What is slate-history?

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.

What are slate-history's main functionalities?

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: [] };

Other packages similar to slate-history

Keywords

FAQs

Package last updated on 24 Oct 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