From 038a5780505e365d240bd1684ec1445fb89412a0 Mon Sep 17 00:00:00 2001 From: caoliwen1 <14658249+caoliwen1@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 08:53:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=89=88readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..e675324 --- /dev/null +++ b/README.en.md @@ -0,0 +1,49 @@ +# Customizing the Touch and Hold Menu on the Web Page + +### Overview + +This sample describes how to bind a custom menu to a tapable element (hyperlink or image) on the web page. + +### Preview + +![](./screenshots/device/web.gif) + +##### How to Use + +Touch and hold an image or link on a web page to display the customized menu and create customized operations, such as copying an image, opening a link using a browser, and copying a link. + +### Project Directory + +``` +├──entry/src/main/ets/ +│ ├──common +│ │ └──CommonConstants.ets // Common constant class +│ │ └──Utils.ets // Utils functions +│ ├──entryability +│ │ └──EntryAbility.ets // Entry point class +│ └──pages +│ └──Index.ets // Home page +└──entry/src/main/resources // Static resources of the app +``` + +### How to Implement + +1. Create a web component, import the sample HTML file, and bind the pop-up menu component. + +2. Invoke the **onContextMenuShow** function of the web component to obtain the pop-up menu information of the current page element, such as the location information, current link, whether media elements such as images exist, and event source. + +3. Create a customized menu. You can obtain the information and events that trigger the menu element from the **onContextMenuShow** event and dynamically create a customized pop-up menu based on the information and events. + +### Required Permissions + +N/A + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. + +2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. + +3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. + +4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 or later. -- Gitee From 9bf9b7fb82e5457a7f9ab243a8e0b049633b4a3b Mon Sep 17 00:00:00 2001 From: caoliwen1 <14658249+caoliwen1@user.noreply.gitee.com> Date: Wed, 23 Oct 2024 20:15:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.en.md b/README.en.md index e675324..8642630 100644 --- a/README.en.md +++ b/README.en.md @@ -2,7 +2,7 @@ ### Overview -This sample describes how to bind a custom menu to a tapable element (hyperlink or image) on the web page. +This sample describes how to bind a custom menu to a tappable element (hyperlink or image) on the web page. ### Preview -- Gitee