8
0

nooperation.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. CKEDITOR.define( [
  7. 'document/operation/operation'
  8. ], ( Operation ) => {
  9. /**
  10. * Operation that is doing nothing ("empty operation", "do-nothing operation", "noop").
  11. * This is an operation, which {@link #_execute} method does not change tree model.
  12. * It still has defined some parameters for transformations purposes.
  13. *
  14. * In most cases this operation is a result of transforming operations. When transformation returns
  15. * {@link document.operation.NoOperation} it means that changes done by the transformed operation
  16. * has already been applied.
  17. *
  18. * @class document.operation.NoOperation
  19. */
  20. class NoOperation extends Operation {
  21. _execute() {
  22. // Do nothing.
  23. }
  24. clone( baseVersion ) {
  25. /* istanbul ignore else */
  26. if ( !baseVersion ) {
  27. baseVersion = this.baseVersion;
  28. }
  29. return new NoOperation( baseVersion );
  30. }
  31. getReversed() {
  32. return new NoOperation( this.baseVersion + 1 );
  33. }
  34. getTransformedBy() {
  35. return this.clone();
  36. }
  37. }
  38. return NoOperation;
  39. } );