@ckeditor/ckeditor5-undo 40.0.0 → 40.2.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/CHANGELOG.md +25 -25
- package/LICENSE.md +2 -2
- package/ckeditor5-metadata.json +23 -0
- package/package.json +4 -4
- package/src/augmentation.d.ts +16 -16
- package/src/augmentation.js +5 -5
- package/src/basecommand.d.ts +72 -72
- package/src/basecommand.js +192 -192
- package/src/index.d.ts +13 -13
- package/src/index.js +11 -11
- package/src/redocommand.d.ts +27 -27
- package/src/redocommand.js +40 -40
- package/src/undo.d.ts +117 -117
- package/src/undo.js +121 -121
- package/src/undocommand.d.ts +37 -37
- package/src/undocommand.js +44 -44
- package/src/undoediting.d.ts +37 -37
- package/src/undoediting.js +82 -82
- package/src/undoui.d.ts +30 -30
- package/src/undoui.js +61 -61
package/CHANGELOG.md
CHANGED
@@ -5,17 +5,17 @@ All changes in the package are documented in the main repository. See: https://g
|
|
5
5
|
|
6
6
|
Changes for the past releases are available below.
|
7
7
|
|
8
|
-
## [19.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v18.0.0...v19.0.0) (2020
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
9
9
|
|
10
10
|
Internal changes only (updated dependencies, documentation, etc.).
|
11
11
|
|
12
12
|
|
13
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v17.0.0...v18.0.0) (2020
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
14
14
|
|
15
15
|
Internal changes only (updated dependencies, documentation, etc.).
|
16
16
|
|
17
17
|
|
18
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v16.0.0...v17.0.0) (2020
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
19
19
|
|
20
20
|
### Bug fixes
|
21
21
|
|
@@ -26,12 +26,12 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
26
26
|
* Updated translations. ([847543d](https://github.com/ckeditor/ckeditor5-undo/commit/847543d))
|
27
27
|
|
28
28
|
|
29
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v15.0.0...v16.0.0) (2019
|
29
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
30
30
|
|
31
31
|
Internal changes only (updated dependencies, documentation, etc.).
|
32
32
|
|
33
33
|
|
34
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.5...v15.0.0) (2019
|
34
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
35
35
|
|
36
36
|
### Other changes
|
37
37
|
|
@@ -39,7 +39,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
39
39
|
* Updated translations. ([c37a6c4](https://github.com/ckeditor/ckeditor5-undo/commit/c37a6c4)) ([1005475](https://github.com/ckeditor/ckeditor5-undo/commit/1005475))
|
40
40
|
|
41
41
|
|
42
|
-
## [11.0.5](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.4...v11.0.5) (2019
|
42
|
+
## [11.0.5](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.4...v11.0.5) (August 26, 2019)
|
43
43
|
|
44
44
|
### Other changes
|
45
45
|
|
@@ -48,33 +48,33 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
48
48
|
* Updated translations. ([6f5803f](https://github.com/ckeditor/ckeditor5-undo/commit/6f5803f))
|
49
49
|
|
50
50
|
|
51
|
-
## [11.0.4](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.3...v11.0.4) (2019
|
51
|
+
## [11.0.4](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.3...v11.0.4) (July 10, 2019)
|
52
52
|
|
53
53
|
Internal changes only (updated dependencies, documentation, etc.).
|
54
54
|
|
55
55
|
|
56
|
-
## [11.0.3](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.2...v11.0.3) (2019
|
56
|
+
## [11.0.3](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.2...v11.0.3) (July 4, 2019)
|
57
57
|
|
58
58
|
### Other changes
|
59
59
|
|
60
60
|
* Use transparent batches in undo & redo commands. Closes [#97](https://github.com/ckeditor/ckeditor5-undo/issues/97). ([ef8b640](https://github.com/ckeditor/ckeditor5-undo/commit/ef8b640))
|
61
61
|
|
62
62
|
|
63
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.1...v11.0.2) (2019
|
63
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.1...v11.0.2) (June 6, 2019)
|
64
64
|
|
65
65
|
### Other changes
|
66
66
|
|
67
67
|
* Updated translations. ([af36370](https://github.com/ckeditor/ckeditor5-undo/commit/af36370))
|
68
68
|
|
69
69
|
|
70
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.0...v11.0.1) (2019
|
70
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-undo/compare/v11.0.0...v11.0.1) (April 4, 2019)
|
71
71
|
|
72
72
|
### Other changes
|
73
73
|
|
74
74
|
* Updated translations. ([69faf7c](https://github.com/ckeditor/ckeditor5-undo/commit/69faf7c))
|
75
75
|
|
76
76
|
|
77
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.4...v11.0.0) (2019
|
77
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.4...v11.0.0) (February 28, 2019)
|
78
78
|
|
79
79
|
### Other changes
|
80
80
|
|
@@ -85,7 +85,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
85
85
|
* Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
|
86
86
|
|
87
87
|
|
88
|
-
## [10.0.4](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.3...v10.0.4) (2018
|
88
|
+
## [10.0.4](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.3...v10.0.4) (December 5, 2018)
|
89
89
|
|
90
90
|
### Other changes
|
91
91
|
|
@@ -93,28 +93,28 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
93
93
|
* Updated translations. ([b2fe351](https://github.com/ckeditor/ckeditor5-undo/commit/b2fe351))
|
94
94
|
|
95
95
|
|
96
|
-
## [10.0.3](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.2...v10.0.3) (2018
|
96
|
+
## [10.0.3](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.2...v10.0.3) (October 8, 2018)
|
97
97
|
|
98
98
|
### Other changes
|
99
99
|
|
100
100
|
* Updated translations. ([7aec2df](https://github.com/ckeditor/ckeditor5-undo/commit/7aec2df))
|
101
101
|
|
102
102
|
|
103
|
-
## [10.0.2](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.1...v10.0.2) (2018
|
103
|
+
## [10.0.2](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.1...v10.0.2) (July 18, 2018)
|
104
104
|
|
105
105
|
### Other changes
|
106
106
|
|
107
107
|
* Updated translations. ([433de24](https://github.com/ckeditor/ckeditor5-undo/commit/433de24))
|
108
108
|
|
109
109
|
|
110
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.0...v10.0.1) (2018
|
110
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-undo/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
111
111
|
|
112
112
|
### Other changes
|
113
113
|
|
114
114
|
* Updated translations. ([d5942d5](https://github.com/ckeditor/ckeditor5-undo/commit/d5942d5))
|
115
115
|
|
116
116
|
|
117
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.4...v10.0.0) (2018
|
117
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
118
118
|
|
119
119
|
### Other changes
|
120
120
|
|
@@ -125,19 +125,19 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
125
125
|
* The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
|
126
126
|
|
127
127
|
|
128
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
128
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
129
129
|
|
130
130
|
Internal changes only (updated dependencies, documentation, etc.).
|
131
131
|
|
132
132
|
|
133
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
133
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
134
134
|
|
135
135
|
### Bug fixes
|
136
136
|
|
137
137
|
* `UndoCommand` and `RedoCommand` should pass batch in `model.Model#enqueueChange` call. Closes [#84](https://github.com/ckeditor/ckeditor5-undo/issues/84). ([497af30](https://github.com/ckeditor/ckeditor5-undo/commit/497af30))
|
138
138
|
|
139
139
|
|
140
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
140
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
141
141
|
|
142
142
|
### Features
|
143
143
|
|
@@ -153,21 +153,21 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
153
153
|
* Updated translations. ([33171d5](https://github.com/ckeditor/ckeditor5-undo/commit/33171d5))
|
154
154
|
|
155
155
|
|
156
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
156
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
157
157
|
|
158
158
|
### Other changes
|
159
159
|
|
160
160
|
* Updated translations. ([847838f](https://github.com/ckeditor/ckeditor5-undo/commit/847838f))
|
161
161
|
|
162
162
|
|
163
|
-
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.9.0...v1.0.0-alpha.1) (2017
|
163
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.9.0...v1.0.0-alpha.1) (October 3, 2017)
|
164
164
|
|
165
165
|
### Bug fixes
|
166
166
|
|
167
167
|
* Selection should be correctly restored when undoing after all editor content was replaced or removed. Closes [#72](https://github.com/ckeditor/ckeditor5-undo/issues/72). ([58f953f](https://github.com/ckeditor/ckeditor5-undo/commit/58f953f))
|
168
168
|
|
169
169
|
|
170
|
-
## [0.9.0](https://github.com/ckeditor/ckeditor5-undo/compare/v0.8.1...v0.9.0) (2017
|
170
|
+
## [0.9.0](https://github.com/ckeditor/ckeditor5-undo/compare/v0.8.1...v0.9.0) (September 3, 2017)
|
171
171
|
|
172
172
|
### Other changes
|
173
173
|
|
@@ -179,14 +179,14 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
179
179
|
* The command API has been changed.
|
180
180
|
|
181
181
|
|
182
|
-
## [0.8.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.8.0...v0.8.1) (2017
|
182
|
+
## [0.8.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.8.0...v0.8.1) (May 7, 2017)
|
183
183
|
|
184
184
|
### Other changes
|
185
185
|
|
186
186
|
* Updated translations. ([d3847a6](https://github.com/ckeditor/ckeditor5-undo/commit/d3847a6))
|
187
187
|
|
188
188
|
|
189
|
-
## [0.8.0](https://github.com/ckeditor/ckeditor5-undo/compare/v0.7.1...v0.8.0) (2017
|
189
|
+
## [0.8.0](https://github.com/ckeditor/ckeditor5-undo/compare/v0.7.1...v0.8.0) (April 5, 2017)
|
190
190
|
|
191
191
|
### Features
|
192
192
|
|
@@ -197,7 +197,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
197
197
|
* Updated translations. ([730bf75](https://github.com/ckeditor/ckeditor5-undo/commit/730bf75))
|
198
198
|
|
199
199
|
|
200
|
-
## [0.7.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.7.0...v0.7.1) (2017
|
200
|
+
## [0.7.1](https://github.com/ckeditor/ckeditor5-undo/compare/v0.7.0...v0.7.1) (March 6, 2017)
|
201
201
|
|
202
202
|
### Other changes
|
203
203
|
|
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 undo feature** – https://github.com/ckeditor/ckeditor5-undo <br>
|
5
|
-
Copyright (c) 2003
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
14
14
|
Trademarks
|
15
15
|
----------
|
16
16
|
|
17
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
17
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"plugins": [
|
3
|
+
{
|
4
|
+
"name": "Undo",
|
5
|
+
"className": "Undo",
|
6
|
+
"description": "Support the undo and redo functionalities.",
|
7
|
+
"docs": "features/undo-redo.html",
|
8
|
+
"path": "src/undo.js",
|
9
|
+
"uiComponents": [
|
10
|
+
{
|
11
|
+
"type": "Button",
|
12
|
+
"name": "undo",
|
13
|
+
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/undo.svg"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"type": "Button",
|
17
|
+
"name": "redo",
|
18
|
+
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/redo.svg"
|
19
|
+
}
|
20
|
+
]
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-undo",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.2.0",
|
4
4
|
"description": "Undo feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,9 +12,9 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"@ckeditor/ckeditor5-core": "40.
|
16
|
-
"@ckeditor/ckeditor5-engine": "40.
|
17
|
-
"@ckeditor/ckeditor5-ui": "40.
|
15
|
+
"@ckeditor/ckeditor5-core": "40.2.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "40.2.0",
|
17
|
+
"@ckeditor/ckeditor5-ui": "40.2.0"
|
18
18
|
},
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|
20
20
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import type { Undo, UndoEditing, UndoUI, UndoCommand, RedoCommand } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface CommandsMap {
|
8
|
-
undo: UndoCommand;
|
9
|
-
redo: RedoCommand;
|
10
|
-
}
|
11
|
-
interface PluginsMap {
|
12
|
-
[Undo.pluginName]: Undo;
|
13
|
-
[UndoEditing.pluginName]: UndoEditing;
|
14
|
-
[UndoUI.pluginName]: UndoUI;
|
15
|
-
}
|
16
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { Undo, UndoEditing, UndoUI, UndoCommand, RedoCommand } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface CommandsMap {
|
8
|
+
undo: UndoCommand;
|
9
|
+
redo: RedoCommand;
|
10
|
+
}
|
11
|
+
interface PluginsMap {
|
12
|
+
[Undo.pluginName]: Undo;
|
13
|
+
[UndoEditing.pluginName]: UndoEditing;
|
14
|
+
[UndoUI.pluginName]: UndoUI;
|
15
|
+
}
|
16
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export {};
|
package/src/basecommand.d.ts
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module undo/basecommand
|
7
|
-
*/
|
8
|
-
import { Command, type Editor } from '@ckeditor/ckeditor5-core';
|
9
|
-
import { type Batch, type Operation, type Range } from '@ckeditor/ckeditor5-engine';
|
10
|
-
/**
|
11
|
-
* Base class for the undo feature commands: {@link module:undo/undocommand~UndoCommand} and {@link module:undo/redocommand~RedoCommand}.
|
12
|
-
*/
|
13
|
-
export default abstract class BaseCommand extends Command {
|
14
|
-
/**
|
15
|
-
* Stack of items stored by the command. These are pairs of:
|
16
|
-
*
|
17
|
-
* * {@link module:engine/model/batch~Batch batch} saved by the command,
|
18
|
-
* * {@link module:engine/model/selection~Selection selection} state at the moment of saving the batch.
|
19
|
-
*/
|
20
|
-
protected _stack: Array<{
|
21
|
-
batch: Batch;
|
22
|
-
selection: {
|
23
|
-
ranges: Array<Range>;
|
24
|
-
isBackward: boolean;
|
25
|
-
};
|
26
|
-
}>;
|
27
|
-
/**
|
28
|
-
* Stores all batches that were created by this command.
|
29
|
-
*
|
30
|
-
* @internal
|
31
|
-
*/
|
32
|
-
_createdBatches: WeakSet<Batch>;
|
33
|
-
/**
|
34
|
-
* @inheritDoc
|
35
|
-
*/
|
36
|
-
constructor(editor: Editor);
|
37
|
-
/**
|
38
|
-
* @inheritDoc
|
39
|
-
*/
|
40
|
-
refresh(): void;
|
41
|
-
/**
|
42
|
-
* Returns all batches created by this command.
|
43
|
-
*/
|
44
|
-
get createdBatches(): WeakSet<Batch>;
|
45
|
-
/**
|
46
|
-
* Stores a batch in the command, together with the selection state of the {@link module:engine/model/document~Document document}
|
47
|
-
* created by the editor which this command is registered to.
|
48
|
-
*
|
49
|
-
* @param batch The batch to add.
|
50
|
-
*/
|
51
|
-
addBatch(batch: Batch): void;
|
52
|
-
/**
|
53
|
-
* Removes all items from the stack.
|
54
|
-
*/
|
55
|
-
clearStack(): void;
|
56
|
-
/**
|
57
|
-
* Restores the {@link module:engine/model/document~Document#selection document selection} state after a batch was undone.
|
58
|
-
*
|
59
|
-
* @param ranges Ranges to be restored.
|
60
|
-
* @param isBackward A flag describing whether the restored range was selected forward or backward.
|
61
|
-
* @param operations Operations which has been applied since selection has been stored.
|
62
|
-
*/
|
63
|
-
protected _restoreSelection(ranges: Array<Range>, isBackward: boolean, operations: Array<Operation>): void;
|
64
|
-
/**
|
65
|
-
* Undoes a batch by reversing that batch, transforming reversed batch and finally applying it.
|
66
|
-
* This is a helper method for {@link #execute}.
|
67
|
-
*
|
68
|
-
* @param batchToUndo The batch to be undone.
|
69
|
-
* @param undoingBatch The batch that will contain undoing changes.
|
70
|
-
*/
|
71
|
-
protected _undo(batchToUndo: Batch, undoingBatch: Batch): void;
|
72
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module undo/basecommand
|
7
|
+
*/
|
8
|
+
import { Command, type Editor } from '@ckeditor/ckeditor5-core';
|
9
|
+
import { type Batch, type Operation, type Range } from '@ckeditor/ckeditor5-engine';
|
10
|
+
/**
|
11
|
+
* Base class for the undo feature commands: {@link module:undo/undocommand~UndoCommand} and {@link module:undo/redocommand~RedoCommand}.
|
12
|
+
*/
|
13
|
+
export default abstract class BaseCommand extends Command {
|
14
|
+
/**
|
15
|
+
* Stack of items stored by the command. These are pairs of:
|
16
|
+
*
|
17
|
+
* * {@link module:engine/model/batch~Batch batch} saved by the command,
|
18
|
+
* * {@link module:engine/model/selection~Selection selection} state at the moment of saving the batch.
|
19
|
+
*/
|
20
|
+
protected _stack: Array<{
|
21
|
+
batch: Batch;
|
22
|
+
selection: {
|
23
|
+
ranges: Array<Range>;
|
24
|
+
isBackward: boolean;
|
25
|
+
};
|
26
|
+
}>;
|
27
|
+
/**
|
28
|
+
* Stores all batches that were created by this command.
|
29
|
+
*
|
30
|
+
* @internal
|
31
|
+
*/
|
32
|
+
_createdBatches: WeakSet<Batch>;
|
33
|
+
/**
|
34
|
+
* @inheritDoc
|
35
|
+
*/
|
36
|
+
constructor(editor: Editor);
|
37
|
+
/**
|
38
|
+
* @inheritDoc
|
39
|
+
*/
|
40
|
+
refresh(): void;
|
41
|
+
/**
|
42
|
+
* Returns all batches created by this command.
|
43
|
+
*/
|
44
|
+
get createdBatches(): WeakSet<Batch>;
|
45
|
+
/**
|
46
|
+
* Stores a batch in the command, together with the selection state of the {@link module:engine/model/document~Document document}
|
47
|
+
* created by the editor which this command is registered to.
|
48
|
+
*
|
49
|
+
* @param batch The batch to add.
|
50
|
+
*/
|
51
|
+
addBatch(batch: Batch): void;
|
52
|
+
/**
|
53
|
+
* Removes all items from the stack.
|
54
|
+
*/
|
55
|
+
clearStack(): void;
|
56
|
+
/**
|
57
|
+
* Restores the {@link module:engine/model/document~Document#selection document selection} state after a batch was undone.
|
58
|
+
*
|
59
|
+
* @param ranges Ranges to be restored.
|
60
|
+
* @param isBackward A flag describing whether the restored range was selected forward or backward.
|
61
|
+
* @param operations Operations which has been applied since selection has been stored.
|
62
|
+
*/
|
63
|
+
protected _restoreSelection(ranges: Array<Range>, isBackward: boolean, operations: Array<Operation>): void;
|
64
|
+
/**
|
65
|
+
* Undoes a batch by reversing that batch, transforming reversed batch and finally applying it.
|
66
|
+
* This is a helper method for {@link #execute}.
|
67
|
+
*
|
68
|
+
* @param batchToUndo The batch to be undone.
|
69
|
+
* @param undoingBatch The batch that will contain undoing changes.
|
70
|
+
*/
|
71
|
+
protected _undo(batchToUndo: Batch, undoingBatch: Batch): void;
|
72
|
+
}
|