Skip to content

Commit 01f54aa

Browse files
mbaklorleaanthonyatterpac
authored
[V3] windows: fix html drag and drop (wailsapp#4259)
* fix(windows): disable external drag only when EnableDragAndDrop is set * update changelog for html dnd fix * remove redundant commented out code for windows dnd * Fix changelog --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com> Co-authored-by: Atterpac <89053530+atterpac@users.noreply.github.com>
1 parent 70a94bc commit 01f54aa

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

v3/UNRELEASED_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file
2323

2424
## Fixed
2525
<!-- Bug fixes -->
26+
- Fixed HTML level drag and drop on Windows by [@mbaklor](https://github.com/mbaklor) in [#4259](https://github.com/wailsapp/wails/pull/4259)
2627

2728
## Deprecated
2829
<!-- Soon-to-be removed features -->

v3/pkg/application/webview_window_windows.go

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,13 +1837,13 @@ func (w *windowsWebviewWindow) setupChromium() {
18371837
}
18381838
}
18391839

1840-
if chromium.HasCapability(edge.AllowExternalDrop) {
1841-
err := chromium.AllowExternalDrag(false)
1842-
if err != nil {
1843-
globalApplication.handleFatalError(err)
1844-
}
1845-
}
18461840
if w.parent.options.EnableDragAndDrop {
1841+
if chromium.HasCapability(edge.AllowExternalDrop) {
1842+
err := chromium.AllowExternalDrag(false)
1843+
if err != nil {
1844+
globalApplication.handleFatalError(err)
1845+
}
1846+
}
18471847
w.dropTarget = w32.NewDropTarget()
18481848
w.dropTarget.OnDrop = func(files []string) {
18491849
w.parent.emit(events.Windows.WindowDragDrop)
@@ -1902,17 +1902,6 @@ func (w *windowsWebviewWindow) setupChromium() {
19021902
}
19031903
}
19041904

1905-
// We will get round to this
1906-
//if chromium.HasCapability(edge.AllowExternalDrop) {
1907-
// err := chromium.AllowExternalDrag(w.parent.options.EnableDragAndDrop)
1908-
// if err != nil {
1909-
// globalApplication.handleFatalError(err)
1910-
// }
1911-
// if w.parent.options.EnableDragAndDrop {
1912-
// chromium.MessageWithAdditionalObjectsCallback = w.processMessageWithAdditionalObjects
1913-
// }
1914-
//}
1915-
19161905
chromium.Resize()
19171906
settings, err := chromium.GetSettings()
19181907
if err != nil {

0 commit comments

Comments
 (0)