Home

# Class goog.editor.plugins.TagOnEnterHandler

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

extends goog.editor.plugins.EnterHandler

Instance Method Summary
| `breakOutOfEmptyListItemGecko_(?Node li) ⇒ ?Element` If The cursor is in an empty LI then break out of the list like in IE
| `ensureNodeIsWrappedW3c_(?Node node, ?Element container) ⇒ ?Element` Ensures the current node is wrapped in the tag.
| `handleBackspaceInternal(?goog.events.Event e, ?goog.dom.AbstractRange range)` Internal backspace handler.
| `handleDeleteGecko(?goog.events.Event e)` Internal delete key handler.
| `handleEnterAtCursorGeckoInternal(?goog.events.BrowserEvent e, boolean wasCollapsed, ?goog.dom.AbstractRange range)` 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.
| `handleEnterWebkitInternal(?goog.events.BrowserEvent e)` Handle an enter key press in WebKit.
| `handleKeyUpInternal(?goog.events.Event e)` Internal handler for keyup events.
| `handleRegularEnterGecko_() ⇒ ?Element` Called in response to a normal enter keystroke. It has the action of splitting elements.
| `isSupportedCommand(string command) ⇒ boolean` Whether the string corresponds to a command this plugin handles.
| `markBrToNotBeRemoved_(?goog.dom.AbstractRange range, boolean isBackspace)` When we delete an element, FF inserts a BR. We want to strip that BR after the fact, but in the case where your cursor is at a character right before a BR and you delete that character, we don't want to strip it. So we detect this case on keydown and mark the BR as not needing removal.
| `processParagraphTagsInternal(?goog.events.Event e, boolean split)` Fix paragraphs to be the correct type of node.
| `removeBrIfNecessary_(boolean isBackSpace)` If we hit delete/backspace to merge elements, FF inserts a BR. We want to strip that BR. In markBrToNotBeRemoved, we detect if there was already a BR there before the delete/backspace so that we don't accidentally remove a user-inserted BR.
| `scrollCursorIntoViewGecko_(?Element element)` Scroll the cursor into view, resulting from splitting the paragraph/adding a br. It behaves differently than scrollIntoView

Static Method Summary
| `findAnchorInTraversal_(?Node node, boolean= opt_useFirstChild) ⇒ ?Node` Finds the first A element in a traversal from the input node. The input node itself is not included in the search.
| `joinTextNodes_(?Node node, boolean moveForward) ⇒ ?Node` Joins node and its adjacent text nodes together.
| `replaceWhiteSpaceWithNbsp_(?Node textNode, boolean fromStart, boolean isLeaveEmpty)` Replaces leading or trailing spaces of a text node to a single Nbsp.
| `splitDomAndAppend_(?Node positionNode, number positionOffset, ?Node node) ⇒ ?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.
| `splitDom_(?Node positionNode, number positionOffset, ?Node= opt_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.
| `trimTabsAndLineBreaks_(string string) ⇒ string` Trim the tabs and line breaks from a string.
| `wrapInContainerW3c_(string nodeName, ?Object position, ?Node container) ⇒ ?Element` Wrap the text indicated by "position" in an HTML container of type "nodeName".