Explorar el Código

Changed: Fixed code style. Docs: Reformatted docs.

Szymon Cofalik hace 7 años
padre
commit
2299bf2867

+ 2 - 1
packages/ckeditor5-undo/src/basecommand.js

@@ -82,7 +82,8 @@ export default class BaseCommand extends Command {
 	 * @protected
 	 * @param {Array.<module:engine/model/range~Range>} ranges Ranges to be restored.
 	 * @param {Boolean} isBackward A flag describing whether the restored range was selected forward or backward.
-	 * @param {Array.<module:engine/model/operation/operation~Operation>} operations Operations which has been applied since selection has been stored.
+	 * @param {Array.<module:engine/model/operation/operation~Operation>} operations Operations which has been applied
+	 * since selection has been stored.
 	 */
 	_restoreSelection( ranges, isBackward, operations ) {
 		const model = this.editor.model;

+ 17 - 16
packages/ckeditor5-undo/src/undo.js

@@ -28,11 +28,11 @@ import UndoUI from './undoui';
  *
  * After some changes happen to the document, the `History` and `UndoCommand` stack can be represented as follows:
  *
- *		  History                           Undo stack
- *		===========             ==================================
- *		[operation A1]                          [batch A]
- *		[operation B1]                          [batch B]
- *		[operation B2]                          [batch C]
+ *		    History                            Undo stack
+ *		==============             ==================================
+ *		[operation A1]                         [batch A]
+ *		[operation B1]                         [batch B]
+ *		[operation B2]                         [batch C]
  *		[operation C1]
  *		[operation C2]
  *		[operation B3]
@@ -40,17 +40,18 @@ import UndoUI from './undoui';
  *
  * Where operations starting with the same letter are from same batch.
  *
- * Undoing a batch means that a set of operations which will reverse the effects of that batch needs to be generated. For example, if a batch
- * added several letters, undoing the batch should remove them. It is important to apply undoing operations in the reversed order,
- * so if a batch has operation `X`, `Y`, `Z`, reversed operations `Zr`, `Yr` and `Xr` need to be applied. Otherwise reversed operation
- * `Xr` would operate on a wrong document state, because operation `X` does not know that operations `Y` and `Z` happened.
+ * Undoing a batch means that a set of operations which will reverse the effects of that batch needs to be generated.
+ * For example, if a batch added several letters, undoing the batch should remove them. It is important to apply undoing
+ * operations in the reversed order, so if a batch has operation `X`, `Y`, `Z`, reversed operations `Zr`, `Yr` and `Xr`
+ * need to be applied. Otherwise reversed operation `Xr` would operate on a wrong document state, because operation `X`
+ * does not know that operations `Y` and `Z` happened.
  *
  * After operations from an undone batch got {@link module:engine/model/operation/operation~Operation#getReversed reversed},
  * one needs to make sure if they are ready to be applied. In the scenario above, operation `C3` is the last operation and `C3r`
  * bases on up-to-date document state, so it can be applied to the document.
  *
- *		  History                           Undo stack
- *		=============             ==================================
+ *		     History                             Undo stack
+ *		=================             ==================================
  *		[ operation A1  ]                      [  batch A  ]
  *		[ operation B1  ]                      [  batch B  ]
  *		[ operation B2  ]             [   processing undoing batch C   ]
@@ -64,9 +65,9 @@ import UndoUI from './undoui';
  * transformed by operations from history that happened after it, so it "knows" about them. Let us assume that `C2' = C2r * B3 * C3 * C3r`,
  * where `*` means "transformed by". Rest of operations from that batch are processed in the same fashion.
  *
- *		  History                           Undo stack                                     Redo stack
- *		=============             ==================================             ==================================
- *		[ operation A1  ]                      [  batch A  ]                                  [ batch Cr ]
+ *		     History                             Undo stack                                      Redo stack
+ *		=================             ==================================             ==================================
+ *		[ operation A1  ]                      [  batch A  ]                                    [ batch Cr ]
  *		[ operation B1  ]                      [  batch B  ]
  *		[ operation B2  ]
  *		[ operation C1  ]
@@ -83,8 +84,8 @@ import UndoUI from './undoui';
  * Redo also is very similar to undo. It has its own stack that is filled with undoing (reversed batches). Operations from
  * batch that is re-done are reversed-back, transformed in proper order and applied to the document.
  *
- *		  History                           Undo stack                                     Redo stack
- *		=============             ==================================             ==================================
+ *		     History                             Undo stack                                      Redo stack
+ *		=================             ==================================             ==================================
  *		[ operation A1  ]                      [  batch A  ]
  *		[ operation B1  ]                      [  batch B  ]
  *		[ operation B2  ]                      [ batch Crr ]

+ 0 - 1
packages/ckeditor5-undo/tests/undoediting-integration.js

@@ -9,7 +9,6 @@ import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
 
 import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 import Position from '@ckeditor/ckeditor5-engine/src/model/position';
-import Batch from '@ckeditor/ckeditor5-engine/src/model/batch';
 import UndoEditing from '../src/undoediting';
 
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';