@ckeditor/ckeditor5-undo 35.3.2 → 35.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/basecommand.js +3 -3
- package/src/undo.js +6 -6
- package/src/undocommand.js +1 -1
- package/src/undoediting.js +3 -3
- package/src/undoui.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-undo",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.4.0",
|
|
4
4
|
"description": "Undo feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ckeditor/ckeditor5-core": "^35.
|
|
16
|
-
"@ckeditor/ckeditor5-engine": "^35.
|
|
17
|
-
"@ckeditor/ckeditor5-ui": "^35.
|
|
15
|
+
"@ckeditor/ckeditor5-core": "^35.4.0",
|
|
16
|
+
"@ckeditor/ckeditor5-engine": "^35.4.0",
|
|
17
|
+
"@ckeditor/ckeditor5-ui": "^35.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.
|
|
21
|
-
"@ckeditor/ckeditor5-clipboard": "^35.
|
|
22
|
-
"@ckeditor/ckeditor5-editor-classic": "^35.
|
|
23
|
-
"@ckeditor/ckeditor5-enter": "^35.
|
|
24
|
-
"@ckeditor/ckeditor5-heading": "^35.
|
|
25
|
-
"@ckeditor/ckeditor5-paragraph": "^35.
|
|
26
|
-
"@ckeditor/ckeditor5-typing": "^35.
|
|
27
|
-
"@ckeditor/ckeditor5-table": "^35.
|
|
28
|
-
"@ckeditor/ckeditor5-utils": "^35.
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.4.0",
|
|
21
|
+
"@ckeditor/ckeditor5-clipboard": "^35.4.0",
|
|
22
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.4.0",
|
|
23
|
+
"@ckeditor/ckeditor5-enter": "^35.4.0",
|
|
24
|
+
"@ckeditor/ckeditor5-heading": "^35.4.0",
|
|
25
|
+
"@ckeditor/ckeditor5-paragraph": "^35.4.0",
|
|
26
|
+
"@ckeditor/ckeditor5-typing": "^35.4.0",
|
|
27
|
+
"@ckeditor/ckeditor5-table": "^35.4.0",
|
|
28
|
+
"@ckeditor/ckeditor5-utils": "^35.4.0",
|
|
29
29
|
"typescript": "^4.8.4",
|
|
30
30
|
"webpack": "^5.58.1",
|
|
31
31
|
"webpack-cli": "^4.9.0"
|
package/src/basecommand.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module undo/basecommand
|
|
7
7
|
*/
|
|
8
|
-
import Command from '@ckeditor/ckeditor5-core
|
|
9
|
-
import { transformSets } from '@ckeditor/ckeditor5-engine
|
|
8
|
+
import { Command } from '@ckeditor/ckeditor5-core';
|
|
9
|
+
import { transformSets } from '@ckeditor/ckeditor5-engine';
|
|
10
10
|
/**
|
|
11
|
-
* Base class for undo feature commands: {@link module:undo/undocommand~UndoCommand} and {@link module:undo/redocommand~RedoCommand}.
|
|
11
|
+
* Base class for the undo feature commands: {@link module:undo/undocommand~UndoCommand} and {@link module:undo/redocommand~RedoCommand}.
|
|
12
12
|
*
|
|
13
13
|
* @protected
|
|
14
14
|
* @extends module:core/command~Command
|
package/src/undo.js
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module undo/undo
|
|
7
7
|
*/
|
|
8
|
-
import Plugin from '@ckeditor/ckeditor5-core
|
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import UndoEditing from './undoediting';
|
|
10
10
|
import UndoUI from './undoui';
|
|
11
11
|
/**
|
|
12
12
|
* The undo feature.
|
|
13
13
|
*
|
|
14
14
|
* This is a "glue" plugin which loads the {@link module:undo/undoediting~UndoEditing undo editing feature}
|
|
15
|
-
* and {@link module:undo/undoui~UndoUI undo UI feature}.
|
|
15
|
+
* and the {@link module:undo/undoui~UndoUI undo UI feature}.
|
|
16
16
|
*
|
|
17
|
-
* Below is
|
|
17
|
+
* Below is an explanation of the undo mechanism working together with {@link module:engine/model/history~History History}:
|
|
18
18
|
*
|
|
19
|
-
* Whenever
|
|
19
|
+
* Whenever an {@link module:engine/model/operation/operation~Operation operation} is applied to the
|
|
20
20
|
* {@link module:engine/model/document~Document document}, it is saved to `History` as is.
|
|
21
21
|
* The {@link module:engine/model/batch~Batch batch} that owns that operation is also saved, in
|
|
22
22
|
* {@link module:undo/undocommand~UndoCommand}, together with the selection that was present in the document before the
|
|
23
23
|
* operation was applied. A batch is saved instead of the operation because changes are undone batch-by-batch, not operation-by-operation
|
|
24
24
|
* and a batch is seen as one undo step.
|
|
25
25
|
*
|
|
26
|
-
* After
|
|
26
|
+
* After changes happen to the document, the `History` and `UndoCommand` stack can be represented as follows:
|
|
27
27
|
*
|
|
28
28
|
* History Undo stack
|
|
29
29
|
* ============== ==================================
|
|
@@ -79,7 +79,7 @@ import UndoUI from './undoui';
|
|
|
79
79
|
* The same algorithm applies: operations from a batch (i.e. `A1`) are reversed and then transformed by operations stored in history.
|
|
80
80
|
*
|
|
81
81
|
* Redo also is very similar to undo. It has its own stack that is filled with undoing (reversed batches). Operations from
|
|
82
|
-
* batch that is re-done are reversed-back, transformed in proper order and applied to the document.
|
|
82
|
+
* the batch that is re-done are reversed-back, transformed in proper order and applied to the document.
|
|
83
83
|
*
|
|
84
84
|
* History Undo stack Redo stack
|
|
85
85
|
* ================= ================================== ==================================
|
package/src/undocommand.js
CHANGED
|
@@ -30,7 +30,7 @@ export default class UndoCommand extends BaseCommand {
|
|
|
30
30
|
const batchIndex = batch ? this._stack.findIndex(a => a.batch == batch) : this._stack.length - 1;
|
|
31
31
|
const item = this._stack.splice(batchIndex, 1)[0];
|
|
32
32
|
const undoingBatch = this.editor.model.createBatch({ isUndo: true });
|
|
33
|
-
// All changes
|
|
33
|
+
// All changes have to be done in one `enqueueChange` callback so other listeners will not
|
|
34
34
|
// step between consecutive operations, or won't do changes to the document before selection is properly restored.
|
|
35
35
|
this.editor.model.enqueueChange(undoingBatch, () => {
|
|
36
36
|
this._undo(item.batch, undoingBatch);
|
package/src/undoediting.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module undo/undoediting
|
|
7
7
|
*/
|
|
8
|
-
import Plugin from '@ckeditor/ckeditor5-core
|
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import UndoCommand from './undocommand';
|
|
10
10
|
import RedoCommand from './redocommand';
|
|
11
11
|
/**
|
|
@@ -28,14 +28,14 @@ export default class UndoEditing extends Plugin {
|
|
|
28
28
|
constructor(editor) {
|
|
29
29
|
super(editor);
|
|
30
30
|
/**
|
|
31
|
-
* The command that manages undo {@link module:engine/model/batch~Batch batches} stack (history).
|
|
31
|
+
* The command that manages the undo {@link module:engine/model/batch~Batch batches} stack (history).
|
|
32
32
|
* Created and registered during the {@link #init feature initialization}.
|
|
33
33
|
*
|
|
34
34
|
* @private
|
|
35
35
|
* @member {module:undo/undocommand~UndoCommand} #_undoCommand
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
|
-
* The command that manages redo {@link module:engine/model/batch~Batch batches} stack (history).
|
|
38
|
+
* The command that manages the redo {@link module:engine/model/batch~Batch batches} stack (history).
|
|
39
39
|
* Created and registered during the {@link #init feature initialization}.
|
|
40
40
|
*
|
|
41
41
|
* @private
|
package/src/undoui.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module undo/undoui
|
|
7
7
|
*/
|
|
8
|
-
import Plugin from '@ckeditor/ckeditor5-core
|
|
9
|
-
import ButtonView from '@ckeditor/ckeditor5-ui
|
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
|
+
import { ButtonView } from '@ckeditor/ckeditor5-ui';
|
|
10
10
|
import undoIcon from '../theme/icons/undo.svg';
|
|
11
11
|
import redoIcon from '../theme/icons/redo.svg';
|
|
12
12
|
/**
|