@ckeditor/ckeditor5-undo 31.1.0 → 34.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +2 -2
- package/README.md +2 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/ast.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/bg.po +1 -1
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +1 -1
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/eo.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/eu.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/km.po +1 -1
- package/lang/translations/kn.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/nb.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/si.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/tt.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/uz.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +14 -14
- package/src/basecommand.js +7 -8
- package/src/index.js +1 -1
- package/src/redocommand.js +2 -2
- package/src/undo.js +1 -1
- package/src/undocommand.js +2 -2
- package/src/undoediting.js +18 -14
- package/src/undoui.js +1 -1
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-2022, [CKSource](http://cksource.com) Holding sp. z o.o. 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](http://cksource.com)
|
17
|
+
**CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
package/README.md
CHANGED
@@ -3,7 +3,8 @@ CKEditor 5 undo feature
|
|
3
3
|
|
4
4
|
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-undo.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-undo)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
6
|
-
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5)
|
6
|
+
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
|
7
|
+
![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-undo)
|
7
8
|
|
8
9
|
This package implements undo support for CKEditor 5.
|
9
10
|
|
package/lang/translations/ar.po
CHANGED
package/lang/translations/ast.po
CHANGED
package/lang/translations/az.po
CHANGED
package/lang/translations/bg.po
CHANGED
package/lang/translations/cs.po
CHANGED
package/lang/translations/da.po
CHANGED
package/lang/translations/de.po
CHANGED
package/lang/translations/el.po
CHANGED
package/lang/translations/en.po
CHANGED
package/lang/translations/eo.po
CHANGED
package/lang/translations/es.po
CHANGED
package/lang/translations/et.po
CHANGED
package/lang/translations/eu.po
CHANGED
package/lang/translations/fa.po
CHANGED
package/lang/translations/fi.po
CHANGED
package/lang/translations/fr.po
CHANGED
package/lang/translations/gl.po
CHANGED
package/lang/translations/he.po
CHANGED
package/lang/translations/hi.po
CHANGED
package/lang/translations/hr.po
CHANGED
package/lang/translations/hu.po
CHANGED
package/lang/translations/id.po
CHANGED
package/lang/translations/it.po
CHANGED
package/lang/translations/ja.po
CHANGED
package/lang/translations/km.po
CHANGED
package/lang/translations/kn.po
CHANGED
package/lang/translations/ko.po
CHANGED
package/lang/translations/ku.po
CHANGED
package/lang/translations/lt.po
CHANGED
package/lang/translations/lv.po
CHANGED
package/lang/translations/nb.po
CHANGED
package/lang/translations/ne.po
CHANGED
package/lang/translations/nl.po
CHANGED
package/lang/translations/no.po
CHANGED
package/lang/translations/pl.po
CHANGED
package/lang/translations/pt.po
CHANGED
package/lang/translations/ro.po
CHANGED
package/lang/translations/ru.po
CHANGED
package/lang/translations/si.po
CHANGED
package/lang/translations/sk.po
CHANGED
package/lang/translations/sq.po
CHANGED
package/lang/translations/sr.po
CHANGED
package/lang/translations/sv.po
CHANGED
package/lang/translations/th.po
CHANGED
package/lang/translations/tk.po
CHANGED
package/lang/translations/tr.po
CHANGED
package/lang/translations/tt.po
CHANGED
package/lang/translations/ug.po
CHANGED
package/lang/translations/uk.po
CHANGED
package/lang/translations/uz.po
CHANGED
package/lang/translations/vi.po
CHANGED
package/lang/translations/zh.po
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-undo",
|
3
|
-
"version": "
|
3
|
+
"version": "34.0.0",
|
4
4
|
"description": "Undo feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,23 +12,23 @@
|
|
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": "^34.0.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "^34.0.0",
|
17
|
+
"@ckeditor/ckeditor5-ui": "^34.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": "^34.0.0",
|
21
|
+
"@ckeditor/ckeditor5-clipboard": "^34.0.0",
|
22
|
+
"@ckeditor/ckeditor5-editor-classic": "^34.0.0",
|
23
|
+
"@ckeditor/ckeditor5-enter": "^34.0.0",
|
24
|
+
"@ckeditor/ckeditor5-heading": "^34.0.0",
|
25
|
+
"@ckeditor/ckeditor5-paragraph": "^34.0.0",
|
26
|
+
"@ckeditor/ckeditor5-typing": "^34.0.0",
|
27
|
+
"@ckeditor/ckeditor5-table": "^34.0.0",
|
28
|
+
"@ckeditor/ckeditor5-utils": "^34.0.0"
|
29
29
|
},
|
30
30
|
"engines": {
|
31
|
-
"node": ">=
|
31
|
+
"node": ">=14.0.0",
|
32
32
|
"npm": ">=5.7.1"
|
33
33
|
},
|
34
34
|
"author": "CKSource (http://cksource.com/)",
|
package/src/basecommand.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
@@ -51,20 +51,19 @@ export default class BaseCommand extends Command {
|
|
51
51
|
|
52
52
|
const options = data[ 1 ];
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
// If batch type is not set, default to non-undoable batch.
|
55
|
+
if ( !options.batchType ) {
|
56
|
+
options.batchType = { isUndoable: false };
|
56
57
|
}
|
57
|
-
|
58
|
-
options.batchType = 'transparent';
|
59
58
|
}, { priority: 'high' } );
|
60
59
|
|
61
60
|
// Clear the stack for the `transparent` batches.
|
62
61
|
this.listenTo( editor.data, 'set', ( evt, data ) => {
|
63
|
-
// We can assume that the object exists
|
64
|
-
// with
|
62
|
+
// We can assume that the object exists and it has a `batchType` property.
|
63
|
+
// It was ensured with a higher priority listener before.
|
65
64
|
const options = data[ 1 ];
|
66
65
|
|
67
|
-
if ( options.batchType
|
66
|
+
if ( !options.batchType.isUndoable ) {
|
68
67
|
this.clearStack();
|
69
68
|
}
|
70
69
|
} );
|
package/src/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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-2022, 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 RedoCommand extends BaseCommand {
|
|
30
30
|
*/
|
31
31
|
execute() {
|
32
32
|
const item = this._stack.pop();
|
33
|
-
const redoingBatch = this.editor.model.createBatch(
|
33
|
+
const redoingBatch = this.editor.model.createBatch( { isUndo: true } );
|
34
34
|
|
35
35
|
// All changes have to be done in one `enqueueChange` callback so other listeners will not step between consecutive
|
36
36
|
// operations, or won't do changes to the document before selection is properly restored.
|
package/src/undo.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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/undocommand.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
@@ -33,7 +33,7 @@ export default class UndoCommand extends BaseCommand {
|
|
33
33
|
const batchIndex = batch ? this._stack.findIndex( a => a.batch == batch ) : this._stack.length - 1;
|
34
34
|
|
35
35
|
const item = this._stack.splice( batchIndex, 1 )[ 0 ];
|
36
|
-
const undoingBatch = this.editor.model.createBatch(
|
36
|
+
const undoingBatch = this.editor.model.createBatch( { isUndo: true } );
|
37
37
|
|
38
38
|
// All changes has to be done in one `enqueueChange` callback so other listeners will not
|
39
39
|
// step between consecutive operations, or won't do changes to the document before selection is properly restored.
|
package/src/undoediting.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
@@ -87,25 +87,29 @@ export default class UndoEditing extends Plugin {
|
|
87
87
|
|
88
88
|
const isRedoBatch = this._redoCommand._createdBatches.has( batch );
|
89
89
|
const isUndoBatch = this._undoCommand._createdBatches.has( batch );
|
90
|
-
const
|
90
|
+
const wasProcessed = this._batchRegistry.has( batch );
|
91
91
|
|
92
|
-
//
|
93
|
-
if (
|
92
|
+
// Skip the batch if it was already processed.
|
93
|
+
if ( wasProcessed ) {
|
94
94
|
return;
|
95
|
-
} else {
|
96
|
-
if ( isRedoBatch ) {
|
97
|
-
// If this batch comes from `redoCommand`, add it to `undoCommand` stack.
|
98
|
-
this._undoCommand.addBatch( batch );
|
99
|
-
} else if ( !isUndoBatch ) {
|
100
|
-
// A default batch - these are new changes in the document, not introduced by undo feature.
|
101
|
-
// Add them to `undoCommand` stack and clear `redoCommand` stack.
|
102
|
-
this._undoCommand.addBatch( batch );
|
103
|
-
this._redoCommand.clearStack();
|
104
|
-
}
|
105
95
|
}
|
106
96
|
|
107
97
|
// Add the batch to the registry so it will not be processed again.
|
108
98
|
this._batchRegistry.add( batch );
|
99
|
+
|
100
|
+
if ( !batch.isUndoable ) {
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
|
104
|
+
if ( isRedoBatch ) {
|
105
|
+
// If this batch comes from `redoCommand`, add it to the `undoCommand` stack.
|
106
|
+
this._undoCommand.addBatch( batch );
|
107
|
+
} else if ( !isUndoBatch ) {
|
108
|
+
// If the batch comes neither from `redoCommand` nor from `undoCommand` then it is a new, regular batch.
|
109
|
+
// Add the batch to the `undoCommand` stack and clear the `redoCommand` stack.
|
110
|
+
this._undoCommand.addBatch( batch );
|
111
|
+
this._redoCommand.clearStack();
|
112
|
+
}
|
109
113
|
}, { priority: 'highest' } );
|
110
114
|
|
111
115
|
this.listenTo( this._undoCommand, 'revert', ( evt, undoneBatch, undoingBatch ) => {
|
package/src/undoui.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|