@ckeditor/ckeditor5-undo
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
Changelog | ||
========= | ||
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10) | ||
### Bug fixes | ||
* `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)) | ||
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-undo/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15) | ||
@@ -5,0 +12,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-undo", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Undo manager for CKEditor 5.", | ||
@@ -10,19 +10,19 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-engine": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-ui": "^1.0.0-beta.1" | ||
"@ckeditor/ckeditor5-core": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-engine": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-ui": "^1.0.0-beta.2" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-clipboard": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-enter": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-heading": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-paragraph": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-typing": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-utils": "^1.0.0-beta.1", | ||
"@ckeditor/ckeditor5-basic-styles": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-clipboard": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-editor-classic": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-enter": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-heading": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-paragraph": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-typing": "^1.0.0-beta.2", | ||
"@ckeditor/ckeditor5-utils": "^1.0.0-beta.2", | ||
"eslint": "^4.15.0", | ||
"eslint-config-ckeditor5": "^1.0.7", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^6.0.0" | ||
"lint-staged": "^7.0.0" | ||
}, | ||
@@ -35,3 +35,3 @@ "engines": { | ||
"license": "(GPL-2.0 OR LGPL-2.1 OR MPL-1.1)", | ||
"homepage": "https://ckeditor5.github.io", | ||
"homepage": "https://ckeditor.com", | ||
"bugs": "https://github.com/ckeditor/ckeditor5-undo/issues", | ||
@@ -38,0 +38,0 @@ "repository": { |
@@ -17,3 +17,3 @@ CKEditor 5 undo feature | ||
See the [`@ckeditor/ckeditor5-undo` package](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/api/undo.html) page in [CKEditor 5 documentation](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/). | ||
See the [`@ckeditor/ckeditor5-undo` package](https://docs.ckeditor.com/ckeditor5/latest/api/undo.html) page in [CKEditor 5 documentation](https://docs.ckeditor.com/ckeditor5/latest/). | ||
@@ -20,0 +20,0 @@ ## License |
@@ -11,3 +11,2 @@ /** | ||
import Command from '@ckeditor/ckeditor5-core/src/command'; | ||
import Batch from '@ckeditor/ckeditor5-engine/src/model/batch'; | ||
@@ -127,4 +126,5 @@ /** | ||
* @param {module:engine/model/batch~Batch} batchToUndo The batch to be undone. | ||
* @param {module:engine/model/batch~Batch} undoingBatch The batch that will contain undoing changes. | ||
*/ | ||
_undo( batchToUndo ) { | ||
_undo( batchToUndo, undoingBatch ) { | ||
const model = this.editor.model; | ||
@@ -134,3 +134,2 @@ const document = model.document; | ||
// All changes done by the command execution will be saved as one batch. | ||
const undoingBatch = new Batch(); | ||
this._createdBatches.add( undoingBatch ); | ||
@@ -174,4 +173,2 @@ | ||
} | ||
return undoingBatch; | ||
} | ||
@@ -178,0 +175,0 @@ } |
@@ -11,2 +11,3 @@ /** | ||
import BaseCommand from './basecommand'; | ||
import Batch from '@ckeditor/ckeditor5-engine/src/model/batch'; | ||
@@ -34,6 +35,7 @@ /** | ||
const item = this._stack.pop(); | ||
const redoingBatch = new Batch(); | ||
// All changes have to be done in one `enqueueChange` callback so other listeners will not | ||
// step between consecutive deltas, or won't do changes to the document before selection is properly restored. | ||
this.editor.model.enqueueChange( () => { | ||
this.editor.model.enqueueChange( redoingBatch, () => { | ||
const lastDelta = item.batch.deltas[ item.batch.deltas.length - 1 ]; | ||
@@ -44,3 +46,3 @@ const nextBaseVersion = lastDelta.baseVersion + lastDelta.operations.length; | ||
this._restoreSelection( item.selection.ranges, item.selection.isBackward, deltas ); | ||
this._undo( item.batch ); | ||
this._undo( item.batch, redoingBatch ); | ||
} ); | ||
@@ -47,0 +49,0 @@ |
@@ -11,2 +11,3 @@ /** | ||
import BaseCommand from './basecommand'; | ||
import Batch from '@ckeditor/ckeditor5-engine/src/model/batch'; | ||
@@ -37,7 +38,8 @@ /** | ||
const item = this._stack.splice( batchIndex, 1 )[ 0 ]; | ||
const undoingBatch = new Batch(); | ||
// All changes has to be done in one `enqueueChange` callback so other listeners will not | ||
// step between consecutive deltas, or won't do changes to the document before selection is properly restored. | ||
this.editor.model.enqueueChange( () => { | ||
const undoingBatch = this._undo( item.batch ); | ||
this.editor.model.enqueueChange( undoingBatch, () => { | ||
this._undo( item.batch, undoingBatch ); | ||
@@ -44,0 +46,0 @@ const deltas = this.editor.model.document.history.getDeltas( item.batch.baseVersion ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48936
53
560