Skip to content

Commit 160e66d

Browse files
committed
optimize based on comments
1 parent c548bab commit 160e66d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

specs/APIReview_AllowDrop.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ Currently the drag&drop functionality is default enabled in webview2 and there i
33
based upon their scenarios. According to such feature requirements, we add the new API to provide developers with the capability to configure the drag&drop functionality.
44

55
# Description
6-
We add a new `AllowDrop` property in `CoreWebView2Controller`. This API allows end developers to toggle the drag&drop functionality easily.
7-
If it's disabled, any drag&drop actions will keep out of work. By default, it's disabled to accommodate to conventions.
6+
We add a new `AllowDrop` property in `CoreWebView2Controller`.
7+
This API allows end developers to toggle the drag&drop functionality easily.
8+
If it's disabled, any drag&drop actions will keep out of work.
9+
By default, it's enabled to keep consistent with the behavior we had before the API is added.
810

911
# Examples
1012
## C++
@@ -42,7 +44,7 @@ void ToggleAllowDrop(object target, ExecutedRoutedEventArgs e)
4244
{
4345
// Get webView's controller
4446
var controller = _webView.CoreWebView2Controller;
45-
if(controller.AllowDrop)
47+
if (controller.AllowDrop)
4648
{
4749
controller.AllowDrop = false;
4850
}
@@ -56,7 +58,7 @@ void ToggleAllowDrop(object target, ExecutedRoutedEventArgs e)
5658
# Remarks
5759
The `AllowDrop` property already exists in some controls of .net UI framework like WPF and WinForms.
5860
The .net control wrapper for webview2 natively inherits this property.
59-
But actually it doesn't really work until this new API is added.
61+
But actually it doesn't really takes effect until this new API is added.
6062
When the new API is promoted to public, we will adjust the WPF/WinForms webview2 control to consume the new API accordingly.
6163

6264

@@ -72,10 +74,13 @@ See [API Details](#api-details) section below for API reference.
7274
interface ICoreWebView2Controller : IUnknown {
7375
/// Gets the `AllowDrop` property which is used to configure the capability
7476
/// that dropping files into webview2 is allowed or permitted.
75-
[propget] HRESULT AllowDrop([out, retval] BOOL * allowDrop);
77+
/// The default value is TRUE if not ever set.
78+
///
79+
/// \snippet SettingsComponent.cpp ToggleAllowDrop
80+
[propget] HRESULT AllowDrop([out, retval] BOOL* value);
7681
/// Sets the `AllowDrop` property which is used to configure the capability
7782
/// that dropping files into webview2 is allowed or permitted.
78-
[propput] HRESULT AllowDrop([in] BOOL allowDrop);
83+
[propput] HRESULT AllowDrop([in] BOOL value);
7984
}
8085
```
8186

0 commit comments

Comments
 (0)