Class (WebContextMenuResult)

Implements a WebContextMenuResult object. For details about the sample code, see onContextMenuShow.

NOTE

  • The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 9.

  • The sample effect is subject to the actual device.

constructor9+

constructor()

Constructs a WebContextMenuResult object.

System capability: SystemCapability.Web.Webview.Core

closeContextMenu9+

closeContextMenu(): void

Closes this context menu. This API must be called when no operations in WebContextMenuResult are performed.

System capability: SystemCapability.Web.Webview.Core

copyImage9+

copyImage(): void

Copies the image specified in WebContextMenuParam.

System capability: SystemCapability.Web.Webview.Core

copy9+

copy(): void

Copies text related to this context menu.

System capability: SystemCapability.Web.Webview.Core

paste9+

paste(): void

Performs the paste operation related to this context menu.

NOTE

The ohos.permission.READ_PASTEBOARD permission must be declared.

System capability: SystemCapability.Web.Webview.Core

cut9+

cut(): void

Performs the cut operation related to this context menu.

System capability: SystemCapability.Web.Webview.Core

selectAll9+

selectAll(): void

Performs the select all operation related to this context menu.

System capability: SystemCapability.Web.Webview.Core

undo20+

undo(): void

Performs the undo operation related to this context menu.

System capability: SystemCapability.Web.Webview.Core

redo20+

redo(): void

Performs the redo operation related to this context menu, that is, cancels the last undo operation.

System capability: SystemCapability.Web.Webview.Core

pasteAndMatchStyle20+

pasteAndMatchStyle(): void

Performs the paste operation related to the context menu. The pasted content matches the target format and is displayed in plain text.

NOTE

The ohos.permission.READ_PASTEBOARD permission must be declared.

System capability: SystemCapability.Web.Webview.Core

requestPasswordAutoFill23+

requestPasswordAutoFill(): void

Requests the username or password data in the password vault to be automatically filled in the current focused text box.

System capability: SystemCapability.Web.Webview.Core