[webview]Supports custom text selection menus

Signed-off-by: yushihao4 <yushihao4@huawei.com>
This commit is contained in:
yushihao4 2024-05-07 11:59:04 +08:00
parent b5091888cf
commit 96ba57e9eb

View File

@ -7091,6 +7091,16 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
* @since 12
*/
onRenderProcessResponding(callback: OnRenderProcessRespondingCallback): WebAttribute;
/**
* Set the custom text menu.
*
* @param { Array<ExpandedMenuItemOptions> } expandedMenuOptions - Customize text menu options.
* @returns { WebAttribute }
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
selectionMenuOptions(expandedMenuOptions: Array<ExpandedMenuItemOptions>): WebAttribute;
}
/**
@ -7198,3 +7208,41 @@ declare interface SslErrorEvent {
*/
isMainFrame: boolean;
}
/**
* Defines the menu item option.
*
* @interface ExpandedMenuItemOptions
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
declare interface ExpandedMenuItemOptions {
/**
* Customize what the menu displays.
*
* @type { ResourceStr }
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
content: ResourceStr;
/**
* Customize the icon before the menu displays content.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
startIcon?: ResourceStr;
/**
* Get the selected text information.
*
* @type { function }
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
action: (selectedText: {plainText: string}) => void;
}