Open Vovan-VE opened 5 months ago
Hi @Vovan-VE Plese take a look on this example project showing how to implement this feature: https://github.com/beam-transfer/wails-drag-and-drop/blob/main/README.md#demo
The documentation would benefit from more details for sure.
If you get it working you are in the great position to write an docs for that feature since you just learned what you did not know before. Please please consider submitting PR.
@pavelbinar , the demo works in the same way as described above.
I'll move a code away from DomReady
to Startup
and so ban DomReady
for awhile.
Finally I checked Windows. Drop don't work on Windows 10 at all. Drag works. Drop doesn't.
I have similar issues on Windows 11. I tested it on wails-drag-n-drop.
❌If wails dev
is used, no drop events are fired on the go side, but js events are emitted.
✅If wails build -debug
is used, then both js and go events are emitted.
Modified code:
// app.go
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
runtime.OnFileDrop(ctx, a.onFileDrop)
}
func (a *App) onFileDrop(x, y int, paths []string) {
runtime.LogInfof(a.ctx, "drop files: %#v\n", paths)
}
# Wails
Version | v2.9.1
# System
┌────────────────────────────────────────────────────────────────────────┐
| OS | Windows 10 Pro |
| Version | 2009 (Build: 22631) |
| ID | 23H2 |
| Go Version | go1.19.2 |
| Platform | windows |
| Architecture | amd64 |
| CPU | 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz |
| GPU | NVIDIA GeForce RTX 4090 (NVIDIA) - Driver: 31.0.15.5161 |
| Memory | 64GB |
└────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| WebView2 | N/A | Installed | 126.0.2592.113 |
| Nodejs | N/A | Installed | 18.18.0 |
| npm | N/A | Installed | 10.5.0 |
| *upx | N/A | Available | |
| *nsis | N/A | Available | |
└─────────────── * - Optional Dependency ────────────────┘
---
PS C:\Users\crab> systeminfo
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.22631 N/A Build 22631
Checked in v2.9.2 just now. Both subissues are actual still.
We'll look at this as a priority
Description
When only
EnableFileDrop: true
, every time D'n'D happens anOnDomReady
is triggered.When
EnableFileDrop: true, DisableWebViewDrop: true
, D'n'D don't work for files ever. Not sure how this option should be used. I hoped it should prevent p.1 above to happen. (enhance usage documentation)To Reproduce
Expected behaviour
Screenshots
No response
Attempted Fixes
No response
System Details
(v2.9.2 as well - UPD 2024-10-05)
System
Dependencies
Additional context
No response