Class: EditorView

Drupal.quickedit. EditorView

new Drupal.quickedit.EditorView(options)

A base implementation that outlines the structure for in-place editors.

Specific in-place editor implementations should subclass (extend) this View and override whichever method they deem necessary to override.

Typically you would want to override this method to set the originalValue attribute in the FieldModel to such a value that your in-place editor can revert to the original value when necessary.

Name Type Description
options object

An object with the following keys:

Name Type Description
model Drupal.quickedit.EditorModel

The in-place editor state model.

fieldModel Drupal.quickedit.FieldModel

The field model.

See:
Example

If you override this method, you should call this method (the parent class' initialize()) first.

Drupal.quickedit.EditorView.prototype.initialize.call(this, options);

Extends

  • Backbone.View

Methods

Returns the edited element.

For some single cardinality fields, it may be necessary or useful to not in-place edit (and hence decorate) the DOM element with the data-quickedit-field-id attribute (which is the field's wrapper), but a specific element within the field's wrapper. e.g. using a WYSIWYG editor on a body field should happen on the DOM element containing the text itself, not on the field wrapper.

See:
Returns:
Type Description
jQuery A jQuery-wrapped DOM element.

getQuickEditUISettings(){object}

Returns:
Type Description
object Returns 3 Quick Edit UI settings that depend on the in-place editor:
  • Boolean padding: indicates whether padding should be applied to the edited element, to guarantee legibility of text.
  • Boolean unifiedToolbar: provides the in-place editor with the ability to insert its own toolbar UI into Quick Edit's tightly integrated toolbar.
  • Boolean fullWidthToolbar: indicates whether Quick Edit's tightly integrated toolbar should consume the full width of the element, rather than being just long enough to accommodate a label.

Cleans up validation error messages.

Should be called when the state is changed to 'candidate' or 'saving'. In the case of the latter: the user has modified the value in the in-place editor again to attempt to save again. In the case of the latter: the invalid value was discarded.

Reverts the modified value to the original, before editing started.

Saves the modified value in the in-place editor for this field.

Shows validation error messages.

Should be called when the state is changed to 'invalid'.

stateChange(fieldModel, state)

Determines the actions to take given a change of state.

Name Type Description
fieldModel Drupal.quickedit.FieldModel

The quickedit FieldModel that holds the state.

state string

The state of the associated field. One of Drupal.quickedit.FieldModel.states.