Class: Enhancer

sync.formctrls.Enhancer

new Enhancer(formControl, editor)

The base class used for form controls enhancers.

It is used to enhance the rendering created by the server-side code. It can also register event handlers in order to provide editing capability.

Parameters:
Name Type Description
formControl HTMLElement The HTML element to enhance.
editor sync.api.Editor is the editor
Source:

Members

(static) EDITOR_SHORTCUTS

The shortcuts that should be forwarded to the editor instead of being handled by the browser in the form control.
Source:

enhanceDom

Method called to enhance an HTML element that wraps the form control.

This should be implemented in subclasses.

This method may be called on another instance of the form control than the two other methods, enterDocument & exitDocument.

Source:

tabKeyPressCounter :number

The number of tab keypress events generated for one keydown event.
Type:
  • number
Source:

Methods

(static) shouldBeHandledByEditor(e) → {boolean}

Some shortcuts should be handled by the editor, leave them through.
Parameters:
Name Type Description
e goog.events.Event The event.
Source:
Returns:
true if the event should be handled by the editor.
Type
boolean

enterDocument(controller)

Method called to initialize the HTML element after it entered the DOM. This method should be implemented in subclasses to register event handlers on the form-control.

IMPORTANT: It is advisable to call the 'super' method in your implementation. See explanation below.

The editor that embeds the form controls usually calls preventDefault on any browser event on the 'bubble' phase.

However, the default implementation of this method, listens to these events and calls 'stopPropagation' on them on the 'bubble' phase, so that the editor's listener which calls 'preventDefault' does not run. This enables the form control to benefit from native input events: typing, mouse clicks, drag&drop, etc.

Parameters:
Name Type Description
controller sync.ctrl.Controller The document controller.
Source:

exitDocument()

Method called to before the form-control is removed from the document.

This should be implemented in subclasses to remove all the listeners on that element, and to reset any global state that refers to that element.

The default implementation un-registers all the listeners on the form-control registered using the Closure library.

Source:

getParentNode() → {sync.api.dom.Node}

Returns the XML node on which the form control is placed.
Source:
Returns:
the node on which the form control is placed.
Type
sync.api.dom.Node