@ckeditor/ckeditor5-undo 35.3.2 → 36.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +1 -1
- package/package.json +13 -13
- package/src/basecommand.js +4 -4
- package/src/index.js +1 -1
- package/src/redocommand.js +1 -1
- package/src/undo.js +7 -7
- package/src/undocommand.js +2 -2
- package/src/undoediting.js +4 -4
- package/src/undoui.js +3 -3
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
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-undo",
|
3
|
-
"version": "
|
3
|
+
"version": "36.0.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": "^
|
16
|
-
"@ckeditor/ckeditor5-engine": "^
|
17
|
-
"@ckeditor/ckeditor5-ui": "^
|
15
|
+
"@ckeditor/ckeditor5-core": "^36.0.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "^36.0.0",
|
17
|
+
"@ckeditor/ckeditor5-ui": "^36.0.0"
|
18
18
|
},
|
19
19
|
"devDependencies": {
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
21
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
22
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
23
|
-
"@ckeditor/ckeditor5-enter": "^
|
24
|
-
"@ckeditor/ckeditor5-heading": "^
|
25
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
26
|
-
"@ckeditor/ckeditor5-typing": "^
|
27
|
-
"@ckeditor/ckeditor5-table": "^
|
28
|
-
"@ckeditor/ckeditor5-utils": "^
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^36.0.0",
|
21
|
+
"@ckeditor/ckeditor5-clipboard": "^36.0.0",
|
22
|
+
"@ckeditor/ckeditor5-editor-classic": "^36.0.0",
|
23
|
+
"@ckeditor/ckeditor5-enter": "^36.0.0",
|
24
|
+
"@ckeditor/ckeditor5-heading": "^36.0.0",
|
25
|
+
"@ckeditor/ckeditor5-paragraph": "^36.0.0",
|
26
|
+
"@ckeditor/ckeditor5-typing": "^36.0.0",
|
27
|
+
"@ckeditor/ckeditor5-table": "^36.0.0",
|
28
|
+
"@ckeditor/ckeditor5-utils": "^36.0.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
@@ -1,14 +1,14 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
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/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
package/src/redocommand.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
package/src/undo.js
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
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
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
@@ -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
@@ -1,11 +1,11 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
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
@@ -1,12 +1,12 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
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
|
/**
|