Command.js 630 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @param editor pointer to main editor object used to initialize
  3. * each command object with a reference to the editor
  4. * @constructor
  5. */
  6. function Command( editor ) {
  7. this.id = - 1;
  8. this.inMemory = false;
  9. this.updatable = false;
  10. this.type = '';
  11. this.name = '';
  12. this.editor = editor;
  13. }
  14. Command.prototype.toJSON = function () {
  15. var output = {};
  16. output.type = this.type;
  17. output.id = this.id;
  18. output.name = this.name;
  19. return output;
  20. };
  21. Command.prototype.fromJSON = function ( json ) {
  22. this.inMemory = true;
  23. this.type = json.type;
  24. this.id = json.id;
  25. this.name = json.name;
  26. };
  27. export { Command };