Anchor
优质
小牛编辑
126浏览
2023-12-01
Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
Constructors
new Anchor(Document doc, Number row, Number column)
Creates a new Anchor
and associates it with a document.
doc | Document | Required. The document to associate with the anchor |
row | Number | Required. The starting row position |
column | Number | Required. The starting column position |
Events
Anchor.on("change", function(Object e))
Fires whenever the anchor position changes.
Both of these objects have a row
and column
property corresponding to the position.
Events that can trigger this function include setPosition()
.
e | Object | Required. An object containing information about the anchor position. It has two properties:
|
Methods
Anchor.detach()
When called, the 'change'
event listener is removed.
Anchor.getDocument()
返回值: Document
Returns the current document.
Anchor.getPosition()
返回值: Object
Returns an object identifying the row
and column
position of the current anchor.
Anchor.onChange()
Undocumented
Anchor.setPosition(Number row, Number column, Boolean noClip)
Sets the anchor position to the specified row and column. If noClip
is true
, the position is not clipped.
row | Number | Required. The row index to move the anchor to |
column | Number | Required. The column index to move the anchor to |
noClip | Boolean | Required. Identifies if you want the position to be clipped |