Skip to content

Commit 15561c6

Browse files
author
Hosam Tageldin
committed
More API changes
1 parent 0d805ae commit 15561c6

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

specs/ContextMenuRequested.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ The developer can add or remove entries to the default WebView context menu. For
4848
for(UINT32 i = 0; i < itemsCount; i++)
4949
{
5050
CHECK_FAILURE(items->GetValueAtIndex(i, &current));
51-
COREWEBVIEW2_CONTEXT_MENU_ITEM_DESCRIPTOR desc;
52-
CHECK_FAILURE(current->get_Descriptor(&desc));
53-
if (desc == COREWEBVIEW2_CONTEXT_MENU_ITEM_DESCRIPTOR_SAVE_IMAGE_AS)
51+
wil::unique_cotaskmem_string name;
52+
CHECK_FAILURE(current->get_Name(&name));
53+
if (wcsmp(name.get(), L"saveImageAs") == 0)
5454
{
5555
CHECK_FAILURE(items->RemoveValueAtIndex(i));
5656
break;
@@ -235,7 +235,7 @@ The developer can use the data provided in the Event arguments to display a cust
235235
{
236236
for (int index = 0; index < menuList.Count; index++)
237237
{
238-
if (menuList[index].Descriptor == CoreWebView2ContextMenuItemDescriptor.SaveImageAs)
238+
if (menuList[index].Name == "saveImageAs")
239239
{
240240
menuList.RemoveAt(index);
241241
break;
@@ -383,7 +383,10 @@ The developer can use the data provided in the Event arguments to display a cust
383383
{
384384
385385
/// Gets the unlocalized name for the `ContextMenuItem`. Use this to distinguish
386-
/// between context menu item types.
386+
/// between context menu item types. This will be the English label of the menu item in
387+
/// lower camel case. For example, the "Save as" menu item will be "saveAs", extension menu items
388+
/// will be the name of the specific extension label so "Download image" will be "downloadImage".
389+
/// Custom menu items will be "custom" and spellcheck items will be "spellCheck".
387390
[propget] HRESULT Name([out, retval] LPWSTR* value);
388391
389392
/// Gets the localized label for the `ContextMenuItem`. Will contain an ampersand for characters to be used
@@ -480,7 +483,9 @@ The developer can use the data provided in the Event arguments to display a cust
480483
/// Create a `ContextMenuItem` object to insert into the WebView context menu.
481484
/// CoreWebView2 will rewind the stream before decoding. Command Id for new
482485
/// custom menu items will be unique for the lifespan of the ContextMenuRequested
483-
/// event. They will be a unique value between 52600 and 52650.
486+
/// event. There is a limit of 1000 context menu items that can be created per Event instance. The specific
487+
/// command ID values may change from build to build so do not rely on the actual value, but instead use
488+
/// the value given from the object `get_CommandId` instead.
484489
/// The returned `ContextMenuItem` object's `IsEnabled` property will default to `TRUE`
485490
/// and `IsChecked` property will default to `FALSE`.
486491
HRESULT CreateContextMenuItem(

0 commit comments

Comments
 (0)