返回介绍

Anchor

发布于 2019-12-03 22:42:51 字数 5545 浏览 1121 评论 0 收藏 0

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.

docDocumentRequired. The document to associate with the anchor
rowNumberRequired. The starting row position
columnNumberRequired. 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().

eObjectRequired. An object containing information about the anchor position. It has two properties:

  • old: An object describing the old Anchor position
  • value: An object describing the new Anchor position

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.

rowNumberRequired. The row index to move the anchor to
columnNumberRequired. The column index to move the anchor to
noClipBooleanRequired. Identifies if you want the position to be clipped

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文