phcode-dev / phoenix

Phoenix is a modern open-source Code Editor for the web, built for the browser.
https://phcode.dev
GNU Affero General Public License v3.0
1.44k stars 111 forks source link

feat: add drag and drop support in windows and mac desktop apps #1699

Closed abose closed 2 weeks ago

abose commented 2 weeks ago

Related shell change: https://github.com/phcode-dev/phoenix-desktop/pull/441

https://github.com/phcode-dev/phoenix/assets/5336369/7acde94c-55c9-438c-a9d8-ed8ada375b5d

Tauri's file drag and drop is broken. See: https://discord.com/channels/616186924390023171/1245330514404048896

How this is fixed then?

So we create a hidden fileDrop window that has fileDropEnabled set to true. When we detect a file drop drag over event using html5 apis, we use tauri apis to show the fileDrop window over the html element. the bounds over which the window should be rendered is calculated with tauri api's as well. it is tested in multi monitor setups to work in linux, windows and mac.

only in windows and mac desktop, not in linux desktop

In linux there is this strange artifact coming when dropping files over a droppable window. image

so we have disabled this is linux for the time being.

in browser

No yet implemented as we wont get write access to the dropped file/folder in most browsers. deferred till we have cloud storage.

phoenixide commented 2 weeks ago

Thank You for making this pull request.

phoenixide commented 2 weeks ago

Thank You for making this pull request.

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud