It's possible to process file drag and drops in the browser, but there are certain security restrictions. I'm not sure how you would do it with a piece of text, but it's probably possible.
Dragging an image from another website for instance does not give you the image file, but will give you the URL for the image. You may or may not be able to request this file from the remote server, depending on the configuration of that server. But in most cases this is impossible without running your own server to download the images from the remote servers on demand and send them back to your game.
Files dropped from the user file system will appear as a "file" object that can be read, but not written to.
I don't know off the top of the head if we have a mechanism for this, I'm guessing that we don't as it's something that would likely require the binary data plugin and that is still quite new. But I can't see any reasons why we couldn't support it. Maybe do a bit more searching around and file a feature request if you can't find anything.
If your happy with JS then you can use this snippet based on https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop to get a file dropped on the page.
// Put any global functions etc. here
runOnStartup(async runtime =>
{
// Code to run on the loading screen
runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
});
function OnBeforeProjectStart(runtime)
{
document.body.addEventListener("drop", dropHandler);
document.body.addEventListener("dragover", dragOverHandler);
}
function dropHandler(ev) {
console.log('File(s) dropped');
// Prevent default behavior (Prevent file from being opened)
ev.preventDefault();
if (ev.dataTransfer.items) {
// Use DataTransferItemList interface to access the file(s)
for (var i = 0; i < ev.dataTransfer.items.length; i++) {
// If dropped items aren't files, reject them
if (ev.dataTransfer.items[i].kind === 'file') {
var file = ev.dataTransfer.items[i].getAsFile();
console.log('... file[' + i + '].name = ' + file.name);
}
}
} else {
// Use DataTransfer interface to access the file(s)
for (var i = 0; i < ev.dataTransfer.files.length; i++) {
console.log('... file[' + i + '].name = ' + ev.dataTransfer.files[i].name);
}
}
}
function dragOverHandler(ev) {
console.log('File(s) in drop zone');
// Prevent default behavior (Prevent file from being opened)
ev.preventDefault();
}
It requires that you do not use "worker mode" on your game, which is under "advanced" in the project properties.