Kragrathea / pgcode

118 stars 19 forks source link

Feature request: support drag&drop of files from Fluidd when running as embedded iFrame #34

Open MarSoft opened 11 months ago

MarSoft commented 11 months ago

I've configured pgcode as a "webcam" within my Fluidd instance. It shows nice, but when I drag&drop the file from File Browser window to PrettyGCode frame, nothing happens. It would be nice to be able to open files by URL using drag&drop, not just local files. This can be done by changing drop event handler to not only rely on dataTransfer.files object but also call dataTransfer.getData('text') and check if the result looks like a URL (starts with either http:// or https://).

Support for drag&drop from Fluidd would also require a change on the Fluidd side — for now it does not add file URL to the drag&drop event; I've posted it at https://github.com/fluidd-core/fluidd/issues/1202 But the change I've described will let you to drag&drop any hyperlink to Gcode file (provided that the server gives permissive CSRF headers).

twoscoopsofpig commented 6 months ago

@MarSoft - how did you get PGC to show up as a webcam? Notably, I'm running MainSail instead of Fluidd, but shouldn't they both handle it the same if PGC is running as a "webcam"?

twoscoopsofpig commented 6 months ago

Nevermind, I found where Fluidd handles this. Looks like it's a Fluidd-only thing unless I can hack it together myself.