RELEASE 2.11.0 OR ABOVE
Returns Selection information from the editor. Selection information includes four types of location information as follows.
종류 | 설명 |
---|---|
start | The start position of the selection on the document |
end | The end position of the Selection in the document |
anchor | The location where the selection started (ex; the location where the mouse was clicked in case of darting after clicking the mouse) |
focus | Location where selection is finished |
Example:
var selection = editor.getSelection(); var startPosition = selection.start; var endPosition = selection.end; var anchorPosition = selection.anchor; var focusPosition = selection.focus;
Also, Selection is divided into text, cell, and drawingObject according to the selected content type.
Depending on this type, the contents of location information are configured differently as follows.
type | position |
---|---|
text | id : Paragraph ID offset : Position of selection in paragraph |
cell | id: First paragraph ID included in the cell offset : In the case of anchor position, the position where the selection started within the paragraph tableCellId : Cell ID tableId : Table ID |
drawingObject | drawingObjectId : drawingObject ID id : Paragraph ID containing the drawingObject offset : Position of drawingObject in paragraph |
In Selection, type information can be checked as follows.
Example:
var selection = editor.getSelection(); var anchorType = selection.anchor.getType(); var focusType = selection.focus.getType();