org.xwiki.gwt.wysiwyg.client.plugin.link.exec
Class LinkExecutableUtils
java.lang.Object
org.xwiki.gwt.wysiwyg.client.plugin.link.exec.LinkExecutableUtils
public class LinkExecutableUtils
- extends Object
Utility class to perform functions associated to link executables, such as detecting the selected anchor. We have
this as static function in a distinct class since there is no way to insert this on both the
CreateLinkExecutable and UnlinkExecutable hierarchies.
- Version:
- $Id: 3f99a9f415a7abf6b02eaa6328ae89675c9c1bba $
|
Method Summary |
static com.google.gwt.dom.client.AnchorElement |
getSelectedAnchor(RichTextArea rta)
Returns the currently selected anchor element in the passed RichTextArea, as the user perceives the
selection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ANCHOR_TAG_NAME
public static final String ANCHOR_TAG_NAME
- The tag name of the anchor element.
- See Also:
- Constant Field Values
LinkExecutableUtils
protected LinkExecutableUtils()
- Protected constructor.
getSelectedAnchor
public static com.google.gwt.dom.client.AnchorElement getSelectedAnchor(RichTextArea rta)
- Returns the currently selected anchor element in the passed
RichTextArea, as the user perceives the
selection. The algorithm used is as follows:
- find anchor ancestor of the first leaf of the selection. If the first leaf is the selection start container
and the offset is at the end, then eliminate this first leaf and analyze the second
- find anchor ancestor of the last leaf of the selection. If the last leaf is the end container and the
selection starts at its very beginning, skip this and analyze the previous leaf
- is the two ancestor anchors are not null and are the same, this anchor is the selected anchor
- Parameters:
rta - the rich text area whose selection to test
- Returns:
- the anchor in which the current selection is found
Copyright © 2004–2015 XWiki. All rights reserved.