nsIAccessibleEditableText 编辑

accessible/public/nsIAccessibleEditableText.idlScriptable An interface for editing text of an accessible object. The operations it supports includes setting text attributes and text contents while also replacing old text of an object with new text. It also includes and support basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Method overview

void copyText(in long startPos, in long endPos);
void cutText(in long startPos, in long endPos);
void deleteText(in long startPos, in long endPos);
void insertText(in AString text, in long position);
void pasteText(in long position);
void setAttributes(in long startPos, in long endPos, in nsISupports attributes); Unimplemented
void setTextContents(in AString text);

Attributes

AttributeTypeDescription
associatedEditornsIEditorReturns an editor associated with the accessible. Read only. Native code only!

Methods

copyText()

Copies the text range into the clipboard.

void copyText(
  in long startPos,
  in long endPos
);
Parameters
startPos
Start offset of the text to be copied into the clipboard.
endPos
End offset of the text to be copied into the clipboard.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be copied into the clipboard.

cutText()

Deletes a range of text and copies it to the clipboard.

void cutText(
  in long startPos,
  in long endPos
);
Parameters
startPos
Start offset of the text to be deleted and copied to clipboard.
endPos
End offset of the text to be copied into the clipboard.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be deleted or copied into the clipboard.

deleteText()

Deletes a range of text.

void deleteText(
  in long startPos,
  in long endPos
);
Parameters
startPos
Start offset of the text to be deleted.
endPos
End offset of the text to be deleted.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be deleted.

insertText()

Inserts text at the specified position.

void insertText(
  in AString text,
  in long position
);
Parameters
text
Text to be inserted.
position
The offset at which to insert the text.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be inserted.

pasteText()

Pastes text from the clipboard.

void pasteText(
  in long position
);
Parameters
position
The offset at which to insert the text from the system clipboard into the text represented by this object.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be pasted from the clipboard.

setAttributes()

Sets the attributes for the text between the two given indices. The old attributes are replaced by the new list of attributes. For example, sets font styles, such as italic, bold, and so on.

void setAttributes(
  in long startPos,
  in long endPos,
  in nsISupports attributes
);
Parameters
startPos
The start index of the text whose attributes are modified.
endPos
The end index of the text whose attributes are modified.
attributes
The set of attributes that replaces the old list of attributes of the specified text portion.
Exceptions thrown
NS_ERROR_NOT_IMPLEMENTED
Always. The method is not implemented.

setTextContents()

Replaces the text represented by this object with the given text.

void setTextContents(
  in AString text
);
Parameters
text
The text that will replace the old text.
Exceptions thrown
NS_ERROR_FAILURE
Indicates the text cannot be replaced.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:89 次

字数:7308

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文