goog.editor.plugins.TagOnEnterHandler
Classgoog.editor.plugins.TagOnEnterHandler
> goog.editor.plugins.EnterHandler
> goog.editor.Plugin
> goog.events.EventTarget
> goog.Disposable
goog.editor.plugins.TagOnEnterHandler(tag)
Plugin to handle enter keys. This subclass normalizes all browsers to use the given block tag on enter.
tag
{goog.dom.TagName
}
.activeOnUneditableFields
This plugin is active on uneditable fields so it can provide a value for queryCommandValue calls asking for goog.editor.Command.BLOCKQUOTE.
boolean
}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.cleanContentsDom
Inherited from goog.editor.Plugin
.
Cleans the contents of the node passed to it. The node contents are modified directly, and the modifications will subsequently be used, for operations such as saving the innerHTML of the editor etc. Since the plugins act on the DOM directly, this method can be very expensive. This op is invoked even on disabled plugins.
fieldCopy
{!Element
}
.cleanContentsHtml
Inherited from goog.editor.Plugin
.
Cleans the html contents of Trogedit. Both cleanContentsDom and and cleanContentsHtml will be called on contents extracted from Trogedit. The inverse of prepareContentsHtml. This op is invoked even on disabled plugins.
originalHtml
{string
}
string
}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.deleteBrGecko(e)
[protected]Inherited from goog.editor.plugins.EnterHandler
.
Deletes the element at the cursor if it is a BR node, and if it does, calls e.preventDefault to stop the browser from deleting. Only necessary in Gecko as a workaround for mozilla bug 205350 where deleting a BR that is followed by a block element doesn't work (the BR gets immediately replaced). We also need to account for an ill-formed cursor which occurs from us trying to stop the browser from deleting.
e
{goog.events.Event
}
.disable(fieldObject)
Inherited from goog.editor.Plugin
.
Disables this plugin for the specified, registered field object.
fieldObject
{goog.editor.Field
}
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
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.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Inherited from goog.editor.Plugin
.
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 };
.enable(fieldObject)
Inherited from goog.editor.plugins.EnterHandler
.
Enables this plugin for the specified, registered field object. A field object should only be enabled when it is loaded.
fieldObject
{goog.editor.Field
}
.ensureBlockIeOpera(tag, opt_keyUp)
[protected]Inherited from goog.editor.plugins.EnterHandler
.
Ensures all text in IE and Opera to be in the given tag in order to control Enter spacing. Call this when Enter is pressed if desired. We want to make sure the user is always inside of a block (or other nodes listed in goog.editor.plugins.EnterHandler.IGNORE_ENSURE_BLOCK_NODES_). We listen to keypress to force nodes that the user is leaving to turn into blocks, but we also need to listen to keyup to force nodes that the user is entering to turn into blocks. Example: html is: "
tag
{goog.dom.TagName
}
opt_keyUp
{boolean
=}
.execCommand(command, var_args)
Inherited from goog.editor.Plugin
.
Handles execCommand. This default implementation handles dispatching BEFORECHANGE, CHANGE, and SELECTIONCHANGE events, and calls execCommandInternal to perform the actual command. Plugins that want to do their own event dispatching should override execCommand, otherwise it is preferred to only override execCommandInternal. This version of execCommand will only work for single field plugins. Multi-field plugins must override execCommand.
command
{string
}
var_args
{...*}
.execCommandInternal
[protected]Inherited from goog.editor.Plugin
.
Handles execCommand. This default implementation does nothing, and is called by execCommand, which handles event dispatching. This method should be overriden by plugins that don't need to do their own event dispatching. If custom event dispatching is needed, execCommand shoul be overriden instead.
command
{string
}
var_args
{...*}
.fieldObject
[protected] {goog.editor.Field
}Deprecated. Use goog.editor.Plugin.getFieldObject and goog.editor.Plugin.setFieldObject.
Inherited from goog.editor.Plugin
.
The field object this plugin is attached to.
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getFieldDomHelper()
Inherited from goog.editor.Plugin
.
goog.dom.DomHelper
?}
.getFieldObject()
[protected]Inherited from goog.editor.Plugin
.
Sets the field object for use with this plugin.
goog.editor.Field
}
.getNonCollapsingBlankHtml()
[protected]Gets HTML with no contents that won't collapse, for browsers that collapse the empty string.
string
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getTrogClassId()
string
}
.handleBackspaceInternal(e, range)
[protected]Internal backspace handler.
e
{goog.events.Event
}
range
{goog.dom.AbstractRange
}
.handleDeleteGecko(e)
[protected]Internal delete key handler.
e
{goog.events.Event
}
.handleEnterAtCursorGeckoInternal
[protected]Inherited from goog.editor.plugins.EnterHandler
.
Handle an enter key press on collapsed selection. handleEnterGecko_ ensures the selection is collapsed by deleting its contents if it is not. The default implementation does nothing.
e
{goog.events.BrowserEvent
}
wasCollapsed
{boolean
}
range
{goog.dom.AbstractRange
}
.handleEnterWebkitInternal(e)
[protected]Handle an enter key press in WebKit.
e
{goog.events.BrowserEvent
}
.handleKeyDown
Inherited from goog.editor.Plugin
.
Handles keydown. It is run before handleKeyboardShortcut and if it returns true handleKeyboardShortcut will not be called.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyPress(e)
Inherited from goog.editor.plugins.EnterHandler
.
Handles keypress. It is run before handleKeyboardShortcut and if it returns true handleKeyboardShortcut will not be called.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyUp(e)
Inherited from goog.editor.plugins.EnterHandler
.
Handles keyup.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyUpInternal(e)
[protected]Internal handler for keyup events.
e
{goog.events.Event
}
.handleKeyboardShortcut
Inherited from goog.editor.Plugin
.
Handles keyboard shortcuts. Preferred to using handleKey* as it will use the proper event based on browser and will be more performant. If handleKeyPress/handleKeyDown returns true, this will not be called. If the plugin handles the shortcut, it is responsible for dispatching appropriate events (change, selection change at the time of this comment). If the plugin calls execCommand on the editable field, then execCommand already takes care of dispatching events. NOTE: For performance reasons this is only called when any key is pressed in conjunction with ctrl/meta keys OR when a small subset of keys (defined in goog.editor.Field.POTENTIAL_SHORTCUT_KEYCODES_) are pressed without ctrl/meta keys. We specifically don't invoke it when altKey is pressed since alt key is used in many i8n UIs to enter certain characters.
e
{!goog.events.BrowserEvent
}
key
{string
}
isModifierPressed
{boolean
}
boolean
}
.handleSelectionChange
Inherited from goog.editor.Plugin
.
Handles selection change.
opt_e
{!goog.events.BrowserEvent
=}
opt_target
{!Node
=}
boolean
}
.isAutoDispose()
Inherited from goog.editor.Plugin
.
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isEnabled(fieldObject)
Inherited from goog.editor.Plugin
.
Returns whether this plugin is enabled for the field object.
fieldObject
{goog.editor.Field
}
boolean
}
.isSilentCommand
Inherited from goog.editor.Plugin
.
command
{string
}
boolean
}
.isSupportedCommand()
.logger
[protected] {goog.debug.Logger
}Inherited from goog.editor.Plugin
.
The logger for this plugin.
.prepareContentsHtml(html)
Inherited from goog.editor.plugins.EnterHandler
.
If the contents are empty, return the 'default' html for the field. The 'default' contents depend on the enter handling mode, so it makes the most sense in this plugin.
html
{string
}
string
}
.processParagraphTagsInternal(e, split)
[protected]Fix paragraphs to be the correct type of node.
e
{goog.events.Event
}
split
{boolean
}
.queryCommandValue()
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.registerFieldObject(fieldObject)
Inherited from goog.editor.Plugin
.
Registers the field object for use with this plugin.
fieldObject
{goog.editor.Field
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.setAutoDispose(autoDispose)
Inherited from goog.editor.Plugin
.
Set if this plugin should automatically be disposed when the registered field is disposed.
autoDispose
{boolean
}
.setFieldObject(fieldObject)
[protected]Inherited from goog.editor.Plugin
.
Sets the field object for use with this plugin.
fieldObject
{goog.editor.Field
}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.tag
[protected] {goog.dom.TagName
}Inherited from goog.editor.plugins.EnterHandler
.
The type of block level tag to add on enter, for browsers that support specifying the default block-level tag. Can be overriden by subclasses; must be either DIV or P.
.unregisterFieldObject(fieldObj)
Inherited from goog.editor.Plugin
.
Unregisters and disables this plugin for the current field object.
fieldObj
{goog.editor.Field
}