Page tree
Skip to end of metadata
Go to start of metadata

RELEASE 2.11.0 OR ABOVE

Returns Selection information from the editor. Selection information includes four types of location information as follows.

종류설명
startThe start position of the selection on the document
endThe end position of the Selection in the document
anchorThe location where the selection started (ex; the location where the mouse was clicked in case of darting after clicking the mouse)
focusLocation 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.

typeposition
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();
  • No labels