nooperation.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /**
  6. * @module engine/model/operation/nooperation
  7. */
  8. import Operation from './operation';
  9. /**
  10. * Operation which is doing nothing ("empty operation", "do-nothing operation", "noop"). This is an operation,
  11. * which when executed does not change the tree model. It still has some parameters defined for transformation purposes.
  12. *
  13. * In most cases this operation is a result of transforming operations. When transformation returns
  14. * {@link module:engine/model/operation/nooperation~NoOperation} it means that changes done by the transformed operation
  15. * have already been applied.
  16. *
  17. * @extends module:engine/model/operation/operation~Operation
  18. */
  19. export default class NoOperation extends Operation {
  20. get type() {
  21. return 'noop';
  22. }
  23. /**
  24. * Creates and returns an operation that has the same parameters as this operation.
  25. *
  26. * @returns {module:engine/model/operation/nooperation~NoOperation} Clone of this operation.
  27. */
  28. clone() {
  29. return new NoOperation( this.baseVersion );
  30. }
  31. /**
  32. * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
  33. *
  34. * @returns {module:engine/model/operation/nooperation~NoOperation}
  35. */
  36. getReversed() {
  37. return new NoOperation( this.baseVersion + 1 );
  38. }
  39. _execute() {
  40. }
  41. /**
  42. * @inheritDoc
  43. */
  44. static get className() {
  45. return 'engine.model.operation.NoOperation';
  46. }
  47. }