CKEDITOR.plugins.ae_selectionregion Class
src/core/selection-region.js:13
SelectionRegion utility class which provides metadata about the selection. The metadata may be the start and end rectangles, caret region, etc. This class is not intended to be used standalone. Its functions will be merged into each editor instance, so the developer may use them directly via the editor, without making an instance of this class.
Constructor
CKEDITOR.plugins.ae_selectionregion
()
Index
Methods
createSelectionFromPoint
-
x
-
y
Creates selection from two points in page coordinates.
Parameters:
-
x
NumberX point in page coordinates.
-
y
NumberY point in page coordinates.
createSelectionFromRange
-
startX
-
startY
-
endX
-
endY
Creates selection from range. A range consists from two points in page coordinates.
Parameters:
-
startX
NumberX coordinate of the first point.
-
startY
NumberY coordinate of the first point.
-
endX
NumberX coordinate of the second point.
-
endY
NumberY coordinate of the second point.
getCaretRegion
()
Object
Returns the region of the current position of the caret. The points are in page coordinates.
Returns:
Returns object with the following properties:
- bottom
- left
- right
- top
getClientRectsRegion
()
Object
Returns object with data about the client rectangles of the selection, normalized across browses. All offsets below are in page coordinates.
Returns:
Returns object with the following data:
- bottom - bottom offset of all client rectangles
- left - left offset of all client rectangles
- right - right offset of all client rectangles
- top - top offset of all client rectangles
- startRect - An Object, which contains the following information:
- bottom - bottom offset
- height - the height of the rectangle
- left - left offset of the selection
- right - right offset of the selection
- top - top offset of the selection
- width - the width of the rectangle
- endRect - An Object, which contains the following information:
- bottom - bottom offset
- height - the height of the rectangle
- left - left offset of the selection
- right - right offset of the selection
- top - top offset of the selection
- width - the width of the rectangle
If there is no native selection, the objects will be filled with 0.
getSelectionData
()
Object | Null
Returns data for the current selection.
Returns:
Returns an object with the following data:
- element - The currently selected element, if any
- text - The selected text
- region - The data, returned from getSelectionRegion
getSelectionDirection
()
Number
Retrieves the direction of the selection. The direction is from top to bottom or from bottom to top. For IE < 9 it is not possible, so the direction for these browsers will be always CKEDITOR.SELECTION_TOP_TO_BOTTOM.
Returns:
Returns a number which represents selection direction. It might be one of these:
- CKEDITOR.SELECTION_TOP_TO_BOTTOM;
- CKEDITOR.SELECTION_BOTTOM_TO_TOP;
getSelectionRegion
()
Object
Returns the region of the current selection.
Returns:
Returns object which is being returned from getClientRectsRegion with three more properties:
- direction - the direction of the selection. Can be one of these:
- CKEDITOR.SELECTION_TOP_TO_BOTTOM
- CKEDITOR.SELECTION_BOTTOM_TO_TOP
- height - The height of the selection region
- width - The width of the selection region
init
-
editor
Initializer lifecycle implementation for the SelectionRegion plugin.
Parameters:
-
editor
ObjectThe current CKEditor instance.
isSelectionEmpty
()
Boolean
Returns true if the current selection is empty, false otherwise.
Returns:
Returns true if the current selection is empty, false otherwise.