com.ephox.editlive.view
Interface EditorActions


public interface EditorActions

A set of handy editing actions that EditLive! knows how to perform. Instance available via ELJBean.getEditorActions().

Since:
7.5

Method Summary
 int[] findTagAtLocation(HTML.Tag tag, List<?> validTagAttrs, int start, int end)
          Equivalent to selectTagAtCursor but does not use the editor selection.
 void selectLineAtCursor()
          Select the entire line at the cursor (commonly used when triple clicking text)
 void selectTagAtCursor(HTML.Tag tag, List<?> validTagAttrs)
          Select as much text from the cursor as is covered by a given inline tag.
 void selectWordAtCursor()
          Select the current word at the cursor (commonly used when double clicking text)
 

Method Detail

selectWordAtCursor

void selectWordAtCursor()
Select the current word at the cursor (commonly used when double clicking text)


selectLineAtCursor

void selectLineAtCursor()
Select the entire line at the cursor (commonly used when triple clicking text)


selectTagAtCursor

void selectTagAtCursor(HTML.Tag tag,
                       List<?> validTagAttrs)
Select as much text from the cursor as is covered by a given inline tag. If the requested tag does not exist at the cursor, performs selectWordAtCursor() instead.

Because the Document model often splits a single inline tag up into multiple content elements, finding the boundary between tags is quite difficult. Under normal circumstances, two hyperlinks next to each other would both be selected by this algorithm if the only matching performed was using tag == HTML.Tag.A. The validTagAttrs parameter allows precise matching to be performed.

When the editor crosses a content element boundary during this search, it validates that all attribute names in validTagAttrs have the same value in both elements before continuing. This allows matching specific hyperlinks or span tags.

Parameters:
tag - inline tag to search for
validTagAttrs - List of attribute names to match when moving between content elements. If empty, no matching is performed.

findTagAtLocation

int[] findTagAtLocation(HTML.Tag tag,
                        List<?> validTagAttrs,
                        int start,
                        int end)
Equivalent to selectTagAtCursor but does not use the editor selection.

Parameters:
tag - inline tag to search for
validTagAttrs - list of attribute names to match
start - location to start searching backwards through the document
end - location to start searching forwards through the document
Returns:
array in the format [start, end] describing the document locations that contain the requested tag.

Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved.