@ckeditor/ckeditor5-undo 48.2.0 → 48.3.0-alpha.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/dist/undo.d.ts CHANGED
@@ -1,121 +1,121 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module undo/undo
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { UndoEditing } from './undoediting.js';
10
- import { UndoUI } from './undoui.js';
6
+ * @module undo/undo
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { UndoEditing } from "./undoediting.js";
10
+ import { UndoUI } from "./undoui.js";
11
11
  /**
12
- * The undo feature.
13
- *
14
- * This is a "glue" plugin which loads the {@link module:undo/undoediting~UndoEditing undo editing feature}
15
- * and the {@link module:undo/undoui~UndoUI undo UI feature}.
16
- *
17
- * Below is an explanation of the undo mechanism working together with {@link module:engine/model/history~History History}:
18
- *
19
- * Whenever an {@link module:engine/model/operation/operation~Operation operation} is applied to the
20
- * {@link module:engine/model/document~ModelDocument document}, it is saved to `History` as is.
21
- * The {@link module:engine/model/batch~Batch batch} that owns that operation is also saved, in
22
- * {@link module:undo/undocommand~UndoCommand}, together with the selection that was present in the document before the
23
- * operation was applied. A batch is saved instead of the operation because changes are undone batch-by-batch, not operation-by-operation
24
- * and a batch is seen as one undo step.
25
- *
26
- * After changes happen to the document, the `History` and `UndoCommand` stack can be represented as follows:
27
- *
28
- * ```
29
- * History Undo stack
30
- * ============== ==================================
31
- * [operation A1] [ batch A ]
32
- * [operation B1] [ batch B ]
33
- * [operation B2] [ batch C ]
34
- * [operation C1]
35
- * [operation C2]
36
- * [operation B3]
37
- * [operation C3]
38
- * ```
39
- *
40
- * Where operations starting with the same letter are from same batch.
41
- *
42
- * Undoing a batch means that a set of operations which will reverse the effects of that batch needs to be generated.
43
- * For example, if a batch added several letters, undoing the batch should remove them. It is important to apply undoing
44
- * operations in the reversed order, so if a batch has operation `X`, `Y`, `Z`, reversed operations `Zr`, `Yr` and `Xr`
45
- * need to be applied. Otherwise reversed operation `Xr` would operate on a wrong document state, because operation `X`
46
- * does not know that operations `Y` and `Z` happened.
47
- *
48
- * After operations from an undone batch got {@link module:engine/model/operation/operation~Operation#getReversed reversed},
49
- * one needs to make sure if they are ready to be applied. In the scenario above, operation `C3` is the last operation and `C3r`
50
- * bases on up-to-date document state, so it can be applied to the document.
51
- *
52
- * ```
53
- * History Undo stack
54
- * ================= ==================================
55
- * [ operation A1 ] [ batch A ]
56
- * [ operation B1 ] [ batch B ]
57
- * [ operation B2 ] [ processing undoing batch C ]
58
- * [ operation C1 ]
59
- * [ operation C2 ]
60
- * [ operation B3 ]
61
- * [ operation C3 ]
62
- * [ operation C3r ]
63
- * ```
64
- *
65
- * Next is operation `C2`, reversed to `C2r`. `C2r` bases on `C2`, so it bases on the wrong document state. It needs to be
66
- * transformed by operations from history that happened after it, so it "knows" about them. Let us assume that `C2' = C2r * B3 * C3 * C3r`,
67
- * where `*` means "transformed by". Rest of operations from that batch are processed in the same fashion.
68
- *
69
- * ```
70
- * History Undo stack Redo stack
71
- * ================= ================================== ==================================
72
- * [ operation A1 ] [ batch A ] [ batch Cr ]
73
- * [ operation B1 ] [ batch B ]
74
- * [ operation B2 ]
75
- * [ operation C1 ]
76
- * [ operation C2 ]
77
- * [ operation B3 ]
78
- * [ operation C3 ]
79
- * [ operation C3r ]
80
- * [ operation C2' ]
81
- * [ operation C1' ]
82
- * ```
83
- *
84
- * Selective undo works on the same basis, however, instead of undoing the last batch in the undo stack, any batch can be undone.
85
- * The same algorithm applies: operations from a batch (i.e. `A1`) are reversed and then transformed by operations stored in history.
86
- *
87
- * Redo also is very similar to undo. It has its own stack that is filled with undoing (reversed batches). Operations from
88
- * the batch that is re-done are reversed-back, transformed in proper order and applied to the document.
89
- *
90
- * ```
91
- * History Undo stack Redo stack
92
- * ================= ================================== ==================================
93
- * [ operation A1 ] [ batch A ]
94
- * [ operation B1 ] [ batch B ]
95
- * [ operation B2 ] [ batch Crr ]
96
- * [ operation C1 ]
97
- * [ operation C2 ]
98
- * [ operation B3 ]
99
- * [ operation C3 ]
100
- * [ operation C3r ]
101
- * [ operation C2' ]
102
- * [ operation C1' ]
103
- * [ operation C1'r]
104
- * [ operation C2'r]
105
- * [ operation C3rr]
106
- * ```
107
- */
12
+ * The undo feature.
13
+ *
14
+ * This is a "glue" plugin which loads the {@link module:undo/undoediting~UndoEditing undo editing feature}
15
+ * and the {@link module:undo/undoui~UndoUI undo UI feature}.
16
+ *
17
+ * Below is an explanation of the undo mechanism working together with {@link module:engine/model/history~History History}:
18
+ *
19
+ * Whenever an {@link module:engine/model/operation/operation~Operation operation} is applied to the
20
+ * {@link module:engine/model/document~ModelDocument document}, it is saved to `History` as is.
21
+ * The {@link module:engine/model/batch~Batch batch} that owns that operation is also saved, in
22
+ * {@link module:undo/undocommand~UndoCommand}, together with the selection that was present in the document before the
23
+ * operation was applied. A batch is saved instead of the operation because changes are undone batch-by-batch, not operation-by-operation
24
+ * and a batch is seen as one undo step.
25
+ *
26
+ * After changes happen to the document, the `History` and `UndoCommand` stack can be represented as follows:
27
+ *
28
+ * ```
29
+ * History Undo stack
30
+ * ============== ==================================
31
+ * [operation A1] [ batch A ]
32
+ * [operation B1] [ batch B ]
33
+ * [operation B2] [ batch C ]
34
+ * [operation C1]
35
+ * [operation C2]
36
+ * [operation B3]
37
+ * [operation C3]
38
+ * ```
39
+ *
40
+ * Where operations starting with the same letter are from same batch.
41
+ *
42
+ * Undoing a batch means that a set of operations which will reverse the effects of that batch needs to be generated.
43
+ * For example, if a batch added several letters, undoing the batch should remove them. It is important to apply undoing
44
+ * operations in the reversed order, so if a batch has operation `X`, `Y`, `Z`, reversed operations `Zr`, `Yr` and `Xr`
45
+ * need to be applied. Otherwise reversed operation `Xr` would operate on a wrong document state, because operation `X`
46
+ * does not know that operations `Y` and `Z` happened.
47
+ *
48
+ * After operations from an undone batch got {@link module:engine/model/operation/operation~Operation#getReversed reversed},
49
+ * one needs to make sure if they are ready to be applied. In the scenario above, operation `C3` is the last operation and `C3r`
50
+ * bases on up-to-date document state, so it can be applied to the document.
51
+ *
52
+ * ```
53
+ * History Undo stack
54
+ * ================= ==================================
55
+ * [ operation A1 ] [ batch A ]
56
+ * [ operation B1 ] [ batch B ]
57
+ * [ operation B2 ] [ processing undoing batch C ]
58
+ * [ operation C1 ]
59
+ * [ operation C2 ]
60
+ * [ operation B3 ]
61
+ * [ operation C3 ]
62
+ * [ operation C3r ]
63
+ * ```
64
+ *
65
+ * Next is operation `C2`, reversed to `C2r`. `C2r` bases on `C2`, so it bases on the wrong document state. It needs to be
66
+ * transformed by operations from history that happened after it, so it "knows" about them. Let us assume that `C2' = C2r * B3 * C3 * C3r`,
67
+ * where `*` means "transformed by". Rest of operations from that batch are processed in the same fashion.
68
+ *
69
+ * ```
70
+ * History Undo stack Redo stack
71
+ * ================= ================================== ==================================
72
+ * [ operation A1 ] [ batch A ] [ batch Cr ]
73
+ * [ operation B1 ] [ batch B ]
74
+ * [ operation B2 ]
75
+ * [ operation C1 ]
76
+ * [ operation C2 ]
77
+ * [ operation B3 ]
78
+ * [ operation C3 ]
79
+ * [ operation C3r ]
80
+ * [ operation C2' ]
81
+ * [ operation C1' ]
82
+ * ```
83
+ *
84
+ * Selective undo works on the same basis, however, instead of undoing the last batch in the undo stack, any batch can be undone.
85
+ * The same algorithm applies: operations from a batch (i.e. `A1`) are reversed and then transformed by operations stored in history.
86
+ *
87
+ * Redo also is very similar to undo. It has its own stack that is filled with undoing (reversed batches). Operations from
88
+ * the batch that is re-done are reversed-back, transformed in proper order and applied to the document.
89
+ *
90
+ * ```
91
+ * History Undo stack Redo stack
92
+ * ================= ================================== ==================================
93
+ * [ operation A1 ] [ batch A ]
94
+ * [ operation B1 ] [ batch B ]
95
+ * [ operation B2 ] [ batch Crr ]
96
+ * [ operation C1 ]
97
+ * [ operation C2 ]
98
+ * [ operation B3 ]
99
+ * [ operation C3 ]
100
+ * [ operation C3r ]
101
+ * [ operation C2' ]
102
+ * [ operation C1' ]
103
+ * [ operation C1'r]
104
+ * [ operation C2'r]
105
+ * [ operation C3rr]
106
+ * ```
107
+ */
108
108
  export declare class Undo extends Plugin {
109
- /**
110
- * @inheritDoc
111
- */
112
- static get requires(): readonly [typeof UndoEditing, typeof UndoUI];
113
- /**
114
- * @inheritDoc
115
- */
116
- static get pluginName(): "Undo";
117
- /**
118
- * @inheritDoc
119
- */
120
- static get isOfficialPlugin(): true;
109
+ /**
110
+ * @inheritDoc
111
+ */
112
+ static get requires(): PluginDependenciesOf<[UndoEditing, UndoUI]>;
113
+ /**
114
+ * @inheritDoc
115
+ */
116
+ static get pluginName(): "Undo";
117
+ /**
118
+ * @inheritDoc
119
+ */
120
+ static override get isOfficialPlugin(): true;
121
121
  }
@@ -1,28 +1,28 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module undo/undocommand
7
- */
8
- import { UndoRedoBaseCommand } from './basecommand.js';
9
- import type { Batch } from '@ckeditor/ckeditor5-engine';
6
+ * @module undo/undocommand
7
+ */
8
+ import { UndoRedoBaseCommand } from "./basecommand.js";
9
+ import type { Batch } from "@ckeditor/ckeditor5-engine";
10
10
  /**
11
- * The undo command stores {@link module:engine/model/batch~Batch batches} applied to the
12
- * {@link module:engine/model/document~ModelDocument document} and is able to undo a batch by reversing it and transforming by
13
- * batches from {@link module:engine/model/document~ModelDocument#history history} that happened after the reversed batch.
14
- *
15
- * The undo command also takes care of restoring the {@link module:engine/model/document~ModelDocument#selection document selection}.
16
- */
11
+ * The undo command stores {@link module:engine/model/batch~Batch batches} applied to the
12
+ * {@link module:engine/model/document~ModelDocument document} and is able to undo a batch by reversing it and transforming by
13
+ * batches from {@link module:engine/model/document~ModelDocument#history history} that happened after the reversed batch.
14
+ *
15
+ * The undo command also takes care of restoring the {@link module:engine/model/document~ModelDocument#selection document selection}.
16
+ */
17
17
  export declare class UndoCommand extends UndoRedoBaseCommand {
18
- /**
19
- * Executes the command. This method reverts a {@link module:engine/model/batch~Batch batch} added to the command's stack, transforms
20
- * and applies the reverted version on the {@link module:engine/model/document~ModelDocument document} and removes the batch from
21
- * the stack. Then, it restores the {@link module:engine/model/document~ModelDocument#selection document selection}.
22
- *
23
- * @fires execute
24
- * @fires revert
25
- * @param batch A batch that should be undone. If not set, the last added batch will be undone.
26
- */
27
- execute(batch?: Batch | null): void;
18
+ /**
19
+ * Executes the command. This method reverts a {@link module:engine/model/batch~Batch batch} added to the command's stack, transforms
20
+ * and applies the reverted version on the {@link module:engine/model/document~ModelDocument document} and removes the batch from
21
+ * the stack. Then, it restores the {@link module:engine/model/document~ModelDocument#selection document selection}.
22
+ *
23
+ * @fires execute
24
+ * @fires revert
25
+ * @param batch A batch that should be undone. If not set, the last added batch will be undone.
26
+ */
27
+ override execute(batch?: Batch | null): void;
28
28
  }
@@ -1,41 +1,41 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module undo/undoediting
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
6
+ * @module undo/undoediting
7
+ */
8
+ import { Plugin } from "@ckeditor/ckeditor5-core";
9
9
  /**
10
- * The undo engine feature.
11
- *
12
- * It introduces the `'undo'` and `'redo'` commands to the editor.
13
- */
10
+ * The undo engine feature.
11
+ *
12
+ * It introduces the `'undo'` and `'redo'` commands to the editor.
13
+ */
14
14
  export declare class UndoEditing extends Plugin {
15
- /**
16
- * The command that manages the undo {@link module:engine/model/batch~Batch batches} stack (history).
17
- * Created and registered during the {@link #init feature initialization}.
18
- */
19
- private _undoCommand;
20
- /**
21
- * The command that manages the redo {@link module:engine/model/batch~Batch batches} stack (history).
22
- * Created and registered during the {@link #init feature initialization}.
23
- */
24
- private _redoCommand;
25
- /**
26
- * Keeps track of which batches were registered in undo.
27
- */
28
- private _batchRegistry;
29
- /**
30
- * @inheritDoc
31
- */
32
- static get pluginName(): "UndoEditing";
33
- /**
34
- * @inheritDoc
35
- */
36
- static get isOfficialPlugin(): true;
37
- /**
38
- * @inheritDoc
39
- */
40
- init(): void;
15
+ /**
16
+ * The command that manages the undo {@link module:engine/model/batch~Batch batches} stack (history).
17
+ * Created and registered during the {@link #init feature initialization}.
18
+ */
19
+ private _undoCommand;
20
+ /**
21
+ * The command that manages the redo {@link module:engine/model/batch~Batch batches} stack (history).
22
+ * Created and registered during the {@link #init feature initialization}.
23
+ */
24
+ private _redoCommand;
25
+ /**
26
+ * Keeps track of which batches were registered in undo.
27
+ */
28
+ private _batchRegistry;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get pluginName(): "UndoEditing";
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ static override get isOfficialPlugin(): true;
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ init(): void;
41
41
  }
package/dist/undoui.d.ts CHANGED
@@ -1,38 +1,38 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module undo/undoui
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
6
+ * @module undo/undoui
7
+ */
8
+ import { Plugin } from "@ckeditor/ckeditor5-core";
9
9
  /**
10
- * The undo UI feature. It introduces the `'undo'` and `'redo'` buttons to the editor.
11
- */
10
+ * The undo UI feature. It introduces the `'undo'` and `'redo'` buttons to the editor.
11
+ */
12
12
  export declare class UndoUI extends Plugin {
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "UndoUI";
17
- /**
18
- * @inheritDoc
19
- */
20
- static get isOfficialPlugin(): true;
21
- /**
22
- * @inheritDoc
23
- */
24
- init(): void;
25
- /**
26
- * Creates a button for the specified command.
27
- *
28
- * @param name Command name.
29
- * @param label Button label.
30
- * @param keystroke Command keystroke.
31
- * @param Icon Source of the icon.
32
- */
33
- private _addButtonsToFactory;
34
- /**
35
- * TODO
36
- */
37
- private _createButton;
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "UndoUI";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static override get isOfficialPlugin(): true;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ /**
26
+ * Creates a button for the specified command.
27
+ *
28
+ * @param name Command name.
29
+ * @param label Button label.
30
+ * @param keystroke Command keystroke.
31
+ * @param Icon Source of the icon.
32
+ */
33
+ private _addButtonsToFactory;
34
+ /**
35
+ * TODO
36
+ */
37
+ private _createButton;
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-undo",
3
- "version": "48.2.0",
3
+ "version": "48.3.0-alpha.0",
4
4
  "description": "Undo feature for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -26,11 +26,11 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@ckeditor/ckeditor5-core": "48.2.0",
30
- "@ckeditor/ckeditor5-engine": "48.2.0",
31
- "@ckeditor/ckeditor5-icons": "48.2.0",
32
- "@ckeditor/ckeditor5-ui": "48.2.0",
33
- "@ckeditor/ckeditor5-utils": "48.2.0"
29
+ "@ckeditor/ckeditor5-core": "48.3.0-alpha.0",
30
+ "@ckeditor/ckeditor5-engine": "48.3.0-alpha.0",
31
+ "@ckeditor/ckeditor5-icons": "48.3.0-alpha.0",
32
+ "@ckeditor/ckeditor5-ui": "48.3.0-alpha.0",
33
+ "@ckeditor/ckeditor5-utils": "48.3.0-alpha.0"
34
34
  },
35
35
  "files": [
36
36
  "dist",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.css"],"names":[],"mappings":";;;;;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["\n\n/*# sourceMappingURL=index.css.map */"]}