EditorModel.es6.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @file
  3. * A Backbone Model for the state of an in-place editor.
  4. *
  5. * @see Drupal.quickedit.EditorView
  6. */
  7. (function(Backbone, Drupal) {
  8. /**
  9. * @constructor
  10. *
  11. * @augments Backbone.Model
  12. */
  13. Drupal.quickedit.EditorModel = Backbone.Model.extend(
  14. /** @lends Drupal.quickedit.EditorModel# */ {
  15. /**
  16. * @type {object}
  17. *
  18. * @prop {string} originalValue
  19. * @prop {string} currentValue
  20. * @prop {Array} validationErrors
  21. */
  22. defaults: /** @lends Drupal.quickedit.EditorModel# */ {
  23. /**
  24. * Not the full HTML representation of this field, but the "actual"
  25. * original value of the field, stored by the used in-place editor, and
  26. * in a representation that can be chosen by the in-place editor.
  27. *
  28. * @type {string}
  29. */
  30. originalValue: null,
  31. /**
  32. * Analogous to originalValue, but the current value.
  33. *
  34. * @type {string}
  35. */
  36. currentValue: null,
  37. /**
  38. * Stores any validation errors to be rendered.
  39. *
  40. * @type {Array}
  41. */
  42. validationErrors: null,
  43. },
  44. },
  45. );
  46. })(Backbone, Drupal);