Objectgoog.Disposable
goog.events.EventTarget
goog.editor.Field
id
:
An identifer for the field. This is used to find the field and the element associated with this field.
|
opt_doc
:
The document that the element with the given id can be found in. If not provided, the default document is used.
|
![]()
Registers a keyboard event listener on the field. This is necessary for
Gecko since the fields are contained in an iFrame and there is no way to
auto-propagate key events up to the main window.
Arguments:
|
code » | |||||
![]()
Given the original field element, and the iframe that is destined to
become the editable field, styles them appropriately and add the iframe
to the dom.
Arguments:
|
code » | |||||
![]()
Attach an wrapper to this field, to be thrown out when the field
is disposed.
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Clears fieldLoadListener for a field. Must be called even (especially?) if
the field is not yet loaded and therefore not in this.fieldMap_
|
code » | |||||
![]()
Stops all listeners and timers.
|
code » | |||||
![]()
Block an event for a short amount of time. Intended
for the situation where an event pair fires in quick succession
(e.g., mousedown/mouseup, keydown/keyup, focus/blur),
and we want the second event in the pair to get "debounced."
WARNING: This should never be used to solve race conditions or for
mission-critical actions. It should only be used for UI improvements,
where it's okay if the behavior is non-deterministic.
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Dispatches a before focus event.
|
code » | |||||
This dispatches the beforetab event on the editable field. If this event is
cancelled, then the default tab behavior is prevented.
Arguments:
Returns:
The result of dispatchEvent.
|
code » | |||||
![]()
Dispatches a blur event.
|
code » | |||||
![]()
Dispatches the appropriate set of change events. This only fires
synchronous change events in blended-mode, iframe-using mozilla. It just
starts the appropriate timer for goog.editor.Field.EventType.DELAYEDCHANGE.
This also starts up change events again if they were stopped.
Arguments:
|
code » | |||||
![]()
Dispatches a command value change event.
|
code » | |||||
![]()
Dispatch a delayed change event.
|
code » | |||||
![]()
Dispatch beforefocus and focus for FF. Note that both of these actually
happen in the document's "focus" event. Unfortunately, we don't actually
have a way of getting in before the focus event in FF (boo! hiss!).
In IE, we use onfocusin for before focus and onfocus for focus.
|
code » | |||||
![]()
Dispatches a focus event.
|
code » | |||||
![]()
Signal that the field is loaded and ready to use. Change events now are
in effect.
|
code » | |||||
![]()
Dispatch a selection change event, optionally caused by the given browser
event.
Arguments:
|
code » | |||||
![]()
Removes all listeners and destroys the eventhandler object.
|
code » | |||||
Executes an editing command as per the registered plugins.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
Returns the "application" window, where dialogs and bubbles
should be rendered.
Returns:
The window.
|
code » | |||||
Returns the zindex of the base level of the field.
Returns:
The base zindex of the editor.
|
code » | |||||
Retrieve the HTML contents of a field.
Do NOT just get the innerHTML of a field directly--there's a lot of
processing that needs to happen.
Returns:
The scrubbed contents of the field.
|
code » | |||||
No description.
Returns:
The dom helper for the editable node.
|
code » | |||||
![]() ?HTMLIFrameElement
No description.
Returns:
?HTMLIFrameElement
The iframe that's body is editable.
|
code » | |||||
Returns the editable DOM element or null if this field
is not editable.
On IE or Safari this is the element with contentEditable=true (in whitebox mode, the iFrame body). On Gecko this is the iFrame body TODO: How do we word this for subclass version?
Returns:
The editable DOM element, defined as above.
|
code » | |||||
Get the copy of the editable field element, which has the innerHTML set
correctly.
Returns:
The copy of the editable field.
|
code » | |||||
No description.
Arguments:
Returns:
The FieldFormatInfo object for this field's configuration.
|
code » | |||||
Returns a string usable as a hash code for this field. For field's
that were created with an id, the hash code is guaranteed to be the id.
TODO: I think we can get rid of this. Seems only used from editor.
Returns:
The hash code for this editable field.
|
code » | |||||
No description.
Returns:
Get the HTML attributes for this field's iframe.
|
code » | |||||
Returns prepared contents that can be injected into the editable field.
|
code » | |||||
Returns original DOM element that is being made editable by Trogedit or
null if that element has not yet been found in the appropriate document.
Returns:
The original element.
|
code » | |||||
Returns the registered plugin with the given classId.
Arguments:
Returns:
Registered plugin with the given classId.
|
code » | |||||
No description.
Returns:
Closure range object wrapping the selection in this field or null if this field is not currently editable.
|
code » | |||||
Handle before change key events and fire the beforetab event if appropriate.
This needs to happen on keydown in IE and keypress in FF.
Arguments:
Returns:
Whether to still perform the default key action. Only set to true if the actual event has already been canceled.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Fires a change event only if the attribute change effects the editiable
field. We ignore events that are internal browser events (ie scrollbar
state change)
Arguments:
|
code » | |||||
![]()
Handle drop events. Deal with focus/selection issues and set the document
as changed.
Arguments:
|
code » | |||||
![]()
Handle the loading of the field (e.g. once the field is ready to setup).
TODO: this should probably just be moved into dispatchLoadEvent_.
|
code » | |||||
![]()
Handles keydown on the field.
Arguments:
|
code » | |||||
![]()
Handles keypress on the field.
Arguments:
|
code » | |||||
![]()
Handles keyup on the field.
Arguments:
|
code » | |||||
![]()
Handles keyboard shortcuts on the field. Note that we bake this into our
handleKeyPress/handleKeyDown rather than using goog.events.KeyHandler or
goog.ui.KeyboardShortcutHandler for performance reasons. Since these
are handled on every key stroke, we do not want to be going out to the
event system every time.
Arguments:
|
code » | |||||
![]()
Handle mouse down inside the editable field.
Arguments:
|
code » | |||||
![]()
Handle mouse up inside the editable field.
Arguments:
|
code » | |||||
![]()
Handle a mutation event.
Arguments:
|
code » | |||||
![]()
The function to call when the editable iframe loads.
|
code » | |||||
No description.
Returns:
Whether we're in modal interaction mode. When this returns true, another plugin is interacting with the field contents in a synchronous way, and expects you not to make changes to the field's DOM structure or selection.
|
code » | |||||
![]()
Prepare the given contents, then inject them into the editable field.
|
code » | |||||
![]()
Installs styles if needed. Only writes styles when they can't be written
inline directly into the field.
|
code » | |||||
![]()
Invoke this operation on all plugins with the given arguments.
Arguments:
|
code » | |||||
Calls all the plugins of the given operation, in sequence, with the
given arguments. This is short-circuiting: once one plugin cancels
the event, no more plugins will be invoked.
Arguments:
Returns:
True if one of the plugins cancel the event, false otherwise.
|
code » | |||||
Checks if the event of the given type has stopped being dispatched
Arguments:
Returns:
true if the event has been stopped with stopEvent().
|
code » | |||||
No description.
Returns:
Whether the field should be rendered with a fixed height, or should expand to fit its contents.
|
code » | |||||
No description.
Returns:
Whether the field has finished loading.
|
code » | |||||
No description.
Returns:
Whether the field is in the process of loading.
|
code » | |||||
Checks the modified state of the field.
Note: Changes that take place while the goog.editor.Field.EventType.CHANGE
event is stopped do not effect the modified state.
Arguments:
Returns:
Whether the field has been modified.
|
code » | |||||
No description.
Returns:
Whether the selection is editable.
|
code » | |||||
No description.
Returns:
Whether the field is uneditable.
|
code » | |||||
![]()
Makes a field editable.
Arguments:
|
code » | |||||
![]()
Handles actually making something editable - creating necessary nodes,
injecting content, etc.
Arguments:
|
code » | |||||
![]()
Start the editable iframe creation process for Mozilla or IE whitebox.
The iframes load asynchronously.
Arguments:
|
code » | |||||
![]()
Closes the field and cancels all pending change timers. Note that this
means that if a change event has not fired yet, it will not fire. Clients
should check fieldOj.isModified() if they depend on the final change event.
Throws an error if the field is already uneditable.
Arguments:
|
code » | |||||
![]()
Calls a function to manipulate the dom of this field. This method should be
used whenever Trogedit clients need to modify the dom of the field, so that
delayed change events are handled appropriately. Extra delayed change events
will cause undesired states to be added to the undo-redo stack. This method
will always fire at most one delayed change event, depending on the value of
{@code opt_preventDelayedChange}.
|
code » | |||||
![]()
No description.
|
code » | |||||
Gets the value of command(s).
|
code » | |||||
Gets the value of this command.
|
code » | |||||
Reduce this argument over all plugins. The result of each plugin invocation
will be passed to the next plugin invocation. See goog.array.reduce.
Arguments:
Returns:
The reduced argument.
|
code » | |||||
![]()
Registers the plugin with the editable field.
Arguments:
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
No description.
|
code » | |||||
![]()
Restores the dom to how it was before being made editable.
|
code » | |||||
![]()
Sets the application window.
Arguments:
|
code » | |||||
![]()
Sets the zIndex that the field should be based off of.
TODO: Get rid of this completely. Here for Sites.
Should this be set directly on UI plugins?
Arguments:
|
code » | |||||
![]()
Sets the contents of the field.
Arguments:
|
code » | |||||
![]()
Sets the value that will replace the style attribute of this field's
element when the field is made non-editable. This method is called with the
current value of the style attribute when the field is made editable.
Arguments:
|
code » | |||||
![]()
Sets the inner HTML of the field. Works on both editable and
uneditable fields.
Arguments:
|
code » | |||||
![]()
No description.
Arguments:
|
code » | |||||
![]()
Initialize listeners on the field.
|
code » | |||||
![]()
Sets up the field object and window util of this field, and enables this
editable field with all registered plugins.
This is essential to the initialization of the field.
It must be called when the field becomes fully loaded and editable.
Arguments:
|
code » | |||||
![]()
Mutation events tell us when something has changed for mozilla.
|
code » | |||||
Returns true if the field needs to be loaded asynchrnously.
Returns:
True if loads are async.
|
code » | |||||
![]()
Start change events again and fire once if desired.
|
code » | |||||
![]()
Re-starts the event of the given type being dispatched, if it had
previously been stopped with stopEvent().
Arguments:
|
code » | |||||
![]()
Temporarily ignore change events. If the time has already been set, it will
fire immediately now. Further setting of the timer is stopped and
dispatching of events is stopped until startChangeEvents is called.
|
code » | |||||
![]()
Stops the event of the given type from being dispatched.
Arguments:
|
code » | |||||
![]()
Help make the field not editable by setting internal data structures to null,
and disabling this field with all registered plugins.
|
code » | |||||
![]()
Attemps to turn on designMode for a document. This function can fail under
certain circumstances related to the load event, and will throw an exception.
|
code » | |||||
![]()
Unregisters the plugin with this field.
Arguments:
|
code » | |||||
No description.
Returns:
Whether the field is implemented as an iframe.
|
code » | |||||
![]()
Writes the html content into the iframe. Handles writing any aditional
styling as well.
|
code » |
![]()
Adds an event listener to the event target. The same handler can only be
added once per the type. Even if you add the same handler multiple times
using the same type then it will only be called once when the event is
dispatched.
Supported for legacy but use goog.events.listen(src, type, handler) instead.
Arguments:
|
code » | |||||
Dispatches an event (or event like object) and calls all listeners
listening for events of this type. The type of the event is decided by the
type property on the event object.
If any of the listeners returns false OR calls preventDefault then this
function will return false. If one of the capture listeners calls
stopPropagation, then the bubble listeners won't fire.
Arguments:
Returns:
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.
|
code » | |||||
![]()
Unattach listeners from this object. Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass }; |
code » | |||||
Returns the parent of this event target to use for bubbling.
Returns:
The parent EventTarget or null if there is no parent.
|
code » | |||||
![]()
Removes an event listener from the event target. The handler must be the
same object as the one added. If the handler has not been added then
nothing is done.
Arguments:
|
code » | |||||
![]()
Sets the parent of this event target to use for bubbling.
Arguments:
|
code » |
![]()
No description.
|
code » | |
![]()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend {@code goog.Disposable} should
override this method. For example:
mypackage.MyClass = function() { goog.Disposable.call(this); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { mypackage.MyClass.superClass_.disposeInternal.call(this); // Dispose logic specific to MyClass. ... }; |
code » | |
No description.
Returns:
Whether the object has been disposed of.
|
code » | |
No description.
Returns:
Whether the object has been disposed of.
|
code » |
![]()
Event handler for clicks in browsers that will follow a link when the user
clicks, even if it's editable. We stop the click manually
Arguments:
|
code » | |||
No description.
Returns:
The id of the active field.
|
code » | |||
Returns true if the keypress generates a change in contents.
Arguments:
Returns:
Whether the keypress generates a change in contents.
|
code » | |||
Returns true if the keypress generates a change in the contents.
due to a special key listed in goog.editor.Field.KEYS_CAUSING_CHANGES_
Arguments:
Returns:
Whether the keypress generated a change in the contents.
|
code » | |||
![]()
Sets the active field id.
Arguments:
|
code » |
Number of milliseconds after a change when the change event should be fired.
|
Code » | |
Map of keyCodes (not charCodes) that when used in conjunction with the
Ctrl key cause changes in the field contents. These are the keys that are
not handled by basic formatting trogedit plugins.
|
Code » | |
Map of keyCodes (not charCodes) that when used in conjunction with the
Ctrl key cause selection changes in the field contents. These are the keys
that are not handled by the basic formatting trogedit plugins. Note that
combinations like Ctrl-left etc are already handled in
SELECTION_CHANGE_KEYCODES_
|
Code » | |
The amount of time that a debounce blocks an event.
TODO: As of 9/30/07, this is only used for blocking
a keyup event after a keydown. We might need to tweak this for other
types of events. Maybe have a per-event debounce time?
|
Code » | |
Number of milliseconds between delayed change events.
|
Code » | |
Map of keyCodes (not charCodes) that cause changes in the field contents.
|
Code » | |
List of mutation events in Gecko browsers.
|
Code » | |
Map of keyCodes (not charCodes) that might need to be handled as a keyboard
shortcut (even when ctrl/meta key is not pressed) by some plugin. Currently
it is a small list. If it grows too big we can optimize it by using ranges
or extending it from SELECTION_CHANGE_KEYCODES_
|
Code » | |
Frequency to check for selection changes.
|
Code » | |
There is at most one "active" field at a time. By "active" field, we mean
a field that has focus and is being used.
|
Code » |