diff core/modules/quickedit/js/models/EditorModel.es6.js @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/quickedit/js/models/EditorModel.es6.js	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,50 @@
+/**
+ * @file
+ * A Backbone Model for the state of an in-place editor.
+ *
+ * @see Drupal.quickedit.EditorView
+ */
+
+(function (Backbone, Drupal) {
+  /**
+   * @constructor
+   *
+   * @augments Backbone.Model
+   */
+  Drupal.quickedit.EditorModel = Backbone.Model.extend(/** @lends Drupal.quickedit.EditorModel# */{
+
+    /**
+     * @type {object}
+     *
+     * @prop {string} originalValue
+     * @prop {string} currentValue
+     * @prop {Array} validationErrors
+     */
+    defaults: /** @lends Drupal.quickedit.EditorModel# */{
+
+      /**
+       * Not the full HTML representation of this field, but the "actual"
+       * original value of the field, stored by the used in-place editor, and
+       * in a representation that can be chosen by the in-place editor.
+       *
+       * @type {string}
+       */
+      originalValue: null,
+
+      /**
+       * Analogous to originalValue, but the current value.
+       *
+       * @type {string}
+       */
+      currentValue: null,
+
+      /**
+       * Stores any validation errors to be rendered.
+       *
+       * @type {Array}
+       */
+      validationErrors: null,
+    },
+
+  });
+}(Backbone, Drupal));