tagonenterhandler.js
No description.

File Location

/goog/editor/plugins/tagonenterhandler.js

Classes

goog.editor.plugins.TagOnEnterHandler
Plugin to handle enter keys. This subclass normalizes all browsers to use the given block tag on enter.

Public Protected Private

Global Functions

goog.editor.plugins.TagOnEnterHandler.findAnchorInTraversal_(nodeopt_useFirstChild) Node
Finds the first A element in a traversal from the input node. The input node itself is not included in the search.
Arguments:
node : Node
The node to start searching from.
opt_useFirstChild : boolean=
Whether to traverse along the first child (true) or last child (false).
Returns: Node  The first anchor node found in the search, or null if none was found.
code »
goog.editor.plugins.TagOnEnterHandler.joinTextNodes_(nodemoveForward) Node
Joins node and its adjacent text nodes together.
Arguments:
node : Node
The node to start joining.
moveForward : boolean
Determines whether to join left siblings (false) or right siblings (true).
Returns: Node  The joined text node.
code »
goog.editor.plugins.TagOnEnterHandler.replaceWhiteSpaceWithNbsp_(textNodefromStartisLeaveEmpty)
Replaces leading or trailing spaces of a text node to a single Nbsp.
Arguments:
textNode : Node
The text node to search and replace white spaces.
fromStart : boolean
Set to true to replace leading spaces, false to replace trailing spaces.
isLeaveEmpty : boolean
Set to true to leave the node empty if the text node was empty in the first place, otherwise put a Nbsp into the text node.
code »
goog.editor.plugins.TagOnEnterHandler.splitDomAndAppend_(positionNodepositionOffsetnode) !Node
Splits the DOM tree around the given node and returns the node containing second half of the tree, which is appended after the old node. The first half of the tree is modified, but not removed from the DOM.
Arguments:
positionNode : Node
Node to split at.
positionOffset : number
Offset into positionNode to split at. If positionNode is a text node, this offset is an offset in to the text content of that node. Otherwise, positionOffset is an offset in to the childNodes array. All elements with child index of positionOffset or greater will be moved to the second half. If positionNode is an empty element, the dom will be split at that element, with positionNode ending up in the second half. positionOffset must be 0 in this case.
node : Node
Node to split.
Returns: !Node  The node containing the second half of the tree.
code »
goog.editor.plugins.TagOnEnterHandler.splitDom_(positionNodepositionOffsetopt_root) !Node
Splits the DOM tree around the given node and returns the node containing the second half of the tree. The first half of the tree is modified, but not removed from the DOM.
Arguments:
positionNode : Node
Node to split at.
positionOffset : number
Offset into positionNode to split at. If positionNode is a text node, this offset is an offset in to the text content of that node. Otherwise, positionOffset is an offset in to the childNodes array. All elements with child index of positionOffset or greater will be moved to the second half. If positionNode is an empty element, the dom will be split at that element, with positionNode ending up in the second half. positionOffset must be 0 in this case.
opt_root : Node=
Node at which to stop splitting the dom (the root is also split).
Returns: !Node  The node containing the second half of the tree.
code »
goog.editor.plugins.TagOnEnterHandler.trimTabsAndLineBreaks_(string) string
Trim the tabs and line breaks from a string.
Arguments:
string : string
String to trim.
Returns: string  Trimmed string.
code »
goog.editor.plugins.TagOnEnterHandler.wrapInContainerW3c_(nodeNamepositioncontainer) !Element
Wrap the text indicated by "position" in an HTML container of type "nodeName".
Arguments:
nodeName : string
Type of container, e.g. "p" (paragraph).
position : Object
The W3C cursor position object (from getCursorPositionW3c).
container : Node
The field containing position.
Returns: !Element  The container element that holds the contents from position.
code »

Directory plugins

File Reference