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

@ckeditor/ckeditor5-undo

Package Overview
Dependencies
Maintainers
1
Versions
789
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-undo - npm Package Compare versions

Comparing version 0.0.0-nightly-20241219.0 to 0.0.0-nightly-20241219.1

173

dist/index.js

@@ -13,16 +13,16 @@ /**

/**
* @inheritDoc
*/ constructor(editor){
* Stack of items stored by the command. These are pairs of:
*
* * {@link module:engine/model/batch~Batch batch} saved by the command,
* * {@link module:engine/model/selection~Selection selection} state at the moment of saving the batch.
*/ _stack = [];
/**
* Stores all batches that were created by this command.
*
* @internal
*/ _createdBatches = new WeakSet();
/**
* @inheritDoc
*/ constructor(editor){
super(editor);
/**
* Stack of items stored by the command. These are pairs of:
*
* * {@link module:engine/model/batch~Batch batch} saved by the command,
* * {@link module:engine/model/selection~Selection selection} state at the moment of saving the batch.
*/ this._stack = [];
/**
* Stores all batches that were created by this command.
*
* @internal
*/ this._createdBatches = new WeakSet();
// Refresh state, so the command is inactive right after initialization.

@@ -61,17 +61,17 @@ this.refresh();

/**
* @inheritDoc
*/ refresh() {
* @inheritDoc
*/ refresh() {
this.isEnabled = this._stack.length > 0;
}
/**
* Returns all batches created by this command.
*/ get createdBatches() {
* Returns all batches created by this command.
*/ get createdBatches() {
return this._createdBatches;
}
/**
* Stores a batch in the command, together with the selection state of the {@link module:engine/model/document~Document document}
* created by the editor which this command is registered to.
*
* @param batch The batch to add.
*/ addBatch(batch) {
* Stores a batch in the command, together with the selection state of the {@link module:engine/model/document~Document document}
* created by the editor which this command is registered to.
*
* @param batch The batch to add.
*/ addBatch(batch) {
const docSelection = this.editor.model.document.selection;

@@ -89,4 +89,4 @@ const selection = {

/**
* Removes all items from the stack.
*/ clearStack() {
* Removes all items from the stack.
*/ clearStack() {
this._stack = [];

@@ -96,8 +96,8 @@ this.refresh();

/**
* Restores the {@link module:engine/model/document~Document#selection document selection} state after a batch was undone.
*
* @param ranges Ranges to be restored.
* @param isBackward A flag describing whether the restored range was selected forward or backward.
* @param operations Operations which has been applied since selection has been stored.
*/ _restoreSelection(ranges, isBackward, operations) {
* Restores the {@link module:engine/model/document~Document#selection document selection} state after a batch was undone.
*
* @param ranges Ranges to be restored.
* @param isBackward A flag describing whether the restored range was selected forward or backward.
* @param operations Operations which has been applied since selection has been stored.
*/ _restoreSelection(ranges, isBackward, operations) {
const model = this.editor.model;

@@ -136,8 +136,8 @@ const document = model.document;

/**
* Undoes a batch by reversing that batch, transforming reversed batch and finally applying it.
* This is a helper method for {@link #execute}.
*
* @param batchToUndo The batch to be undone.
* @param undoingBatch The batch that will contain undoing changes.
*/ _undo(batchToUndo, undoingBatch) {
* Undoes a batch by reversing that batch, transforming reversed batch and finally applying it.
* This is a helper method for {@link #execute}.
*
* @param batchToUndo The batch to be undone.
* @param undoingBatch The batch that will contain undoing changes.
*/ _undo(batchToUndo, undoingBatch) {
const model = this.editor.model;

@@ -206,10 +206,10 @@ const document = model.document;

/**
* Executes the command. This method reverts a {@link module:engine/model/batch~Batch batch} added to the command's stack, transforms
* and applies the reverted version on the {@link module:engine/model/document~Document document} and removes the batch from the stack.
* Then, it restores the {@link module:engine/model/document~Document#selection document selection}.
*
* @fires execute
* @fires revert
* @param batch A batch that should be undone. If not set, the last added batch will be undone.
*/ execute(batch = null) {
* Executes the command. This method reverts a {@link module:engine/model/batch~Batch batch} added to the command's stack, transforms
* and applies the reverted version on the {@link module:engine/model/document~Document document} and removes the batch from the stack.
* Then, it restores the {@link module:engine/model/document~Document#selection document selection}.
*
* @fires execute
* @fires revert
* @param batch A batch that should be undone. If not set, the last added batch will be undone.
*/ execute(batch = null) {
// If batch is not given, set `batchIndex` to the last index in command stack.

@@ -245,9 +245,9 @@ const batchIndex = batch ? this._stack.findIndex((a)=>a.batch == batch) : this._stack.length - 1;

/**
* Executes the command. This method reverts the last {@link module:engine/model/batch~Batch batch} added to
* the command's stack, applies the reverted and transformed version on the
* {@link module:engine/model/document~Document document} and removes the batch from the stack.
* Then, it restores the {@link module:engine/model/document~Document#selection document selection}.
*
* @fires execute
*/ execute() {
* Executes the command. This method reverts the last {@link module:engine/model/batch~Batch batch} added to
* the command's stack, applies the reverted and transformed version on the
* {@link module:engine/model/document~Document document} and removes the batch from the stack.
* Then, it restores the {@link module:engine/model/document~Document#selection document selection}.
*
* @fires execute
*/ execute() {
const item = this._stack.pop();

@@ -275,21 +275,26 @@ const redoingBatch = this.editor.model.createBatch({

*/ class UndoEditing extends Plugin {
constructor(){
super(...arguments);
/**
* Keeps track of which batches were registered in undo.
*/ this._batchRegistry = new WeakSet();
}
/**
* @inheritDoc
*/ static get pluginName() {
* The command that manages the undo {@link module:engine/model/batch~Batch batches} stack (history).
* Created and registered during the {@link #init feature initialization}.
*/ _undoCommand;
/**
* The command that manages the redo {@link module:engine/model/batch~Batch batches} stack (history).
* Created and registered during the {@link #init feature initialization}.
*/ _redoCommand;
/**
* Keeps track of which batches were registered in undo.
*/ _batchRegistry = new WeakSet();
/**
* @inheritDoc
*/ static get pluginName() {
return 'UndoEditing';
}
/**
* @inheritDoc
*/ static get isOfficialPlugin() {
* @inheritDoc
*/ static get isOfficialPlugin() {
return true;
}
/**
* @inheritDoc
*/ init() {
* @inheritDoc
*/ init() {
const editor = this.editor;

@@ -371,14 +376,14 @@ const t = editor.t;

/**
* @inheritDoc
*/ static get pluginName() {
* @inheritDoc
*/ static get pluginName() {
return 'UndoUI';
}
/**
* @inheritDoc
*/ static get isOfficialPlugin() {
* @inheritDoc
*/ static get isOfficialPlugin() {
return true;
}
/**
* @inheritDoc
*/ init() {
* @inheritDoc
*/ init() {
const editor = this.editor;

@@ -393,9 +398,9 @@ const locale = editor.locale;

/**
* Creates a button for the specified command.
*
* @param name Command name.
* @param label Button label.
* @param keystroke Command keystroke.
* @param Icon Source of the icon.
*/ _addButtonsToFactory(name, label, keystroke, Icon) {
* Creates a button for the specified command.
*
* @param name Command name.
* @param label Button label.
* @param keystroke Command keystroke.
* @param Icon Source of the icon.
*/ _addButtonsToFactory(name, label, keystroke, Icon) {
const editor = this.editor;

@@ -414,4 +419,4 @@ editor.ui.componentFactory.add(name, ()=>{

/**
* TODO
*/ _createButton(ButtonClass, name, label, keystroke, Icon) {
* TODO
*/ _createButton(ButtonClass, name, label, keystroke, Icon) {
const editor = this.editor;

@@ -533,4 +538,4 @@ const locale = editor.locale;

/**
* @inheritDoc
*/ static get requires() {
* @inheritDoc
*/ static get requires() {
return [

@@ -542,9 +547,9 @@ UndoEditing,

/**
* @inheritDoc
*/ static get pluginName() {
* @inheritDoc
*/ static get pluginName() {
return 'Undo';
}
/**
* @inheritDoc
*/ static get isOfficialPlugin() {
* @inheritDoc
*/ static get isOfficialPlugin() {
return true;

@@ -551,0 +556,0 @@ }

{
"name": "@ckeditor/ckeditor5-undo",
"version": "0.0.0-nightly-20241219.0",
"version": "0.0.0-nightly-20241219.1",
"description": "Undo feature for CKEditor 5.",

@@ -16,5 +16,5 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20241219.0",
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20241219.0",
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241219.0"
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20241219.1",
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20241219.1",
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241219.1"
},

@@ -21,0 +21,0 @@ "author": "CKSource (http://cksource.com/)",

Sorry, the diff of this file is not supported yet

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