Coder Social home page Coder Social logo

OS Sourced Drag and Drop about chromeless HOT 13 CLOSED

lloyd avatar lloyd commented on May 27, 2024
OS Sourced Drag and Drop

from chromeless.

Comments (13)

lloyd avatar lloyd commented on May 27, 2024

it seems like the example that Mike De Boer cooked up demonstrates that we basic support for OS sourced DND (drag in AND out).

Mike, any thoughts on limitations you've hit so far? Specifically, is it possible to synthetically build up a text or image file that will drag out properly?

from chromeless.

mikedeboer avatar mikedeboer commented on May 27, 2024

I have a sample DnD demonstration inside https://github.com/ajaxorg/chromeless/tree/master/examples/dragdrop

Could you check it out and see if the example is elaborate enough?

from chromeless.

lloyd avatar lloyd commented on May 27, 2024

It looks good. The only feature that I don't see is the ability to drag out an actual file, so that I dragstart on, for instance, a file icon in my ui and drag that to the desktop, and an actual file with a name specified by the web app is created (rather than a text clipping).

I think this could be fairly simply done by using the application/x-moz-file trick mentioned here:

https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types

It seems like if the chromeless application could cause the creation of a local temp file and populate it with content at drag start, then it would be possible to synthesize files and folders out of interface elements.

all that would be needed to do this is the ability to open a temp file with a specific name I think.

Does this make sense? If drag out of arbitrary synthesized file content is important, we should open a new bug to add tempfile/tempdir creation to the appropriate modules.

Thoughts?

from chromeless.

mikedeboer avatar mikedeboer commented on May 27, 2024

I agree and already saw the x-moz-file trick you mention, I just didn't implement it yet. I'm pretty certain it would work and I will finish that part when I get to working on the dragdrop implementation in cloud9.

from chromeless.

taboca avatar taboca commented on May 27, 2024

I am looking a bit this one too ok? Based on meeting I had with Lloyd on yesterday. Trying to help out you guys.

from chromeless.

lloyd avatar lloyd commented on May 27, 2024

yay! thanks marcio!

from chromeless.

taboca avatar taboca commented on May 27, 2024

Here is an update -- outside of our master because this does not work. I also filed a thread in dev-extensions to see other developer's opinion why it did not work. one thing to notice here is that the actual set of file ( nsIFile ) into the dataTransfer is being done in the module ( to workaround security exception ). I also executed the whole thing in system-level privileges and same effect - no drop effect. It's being canceled.

The same is basically Mike's desktop file list sample where expectation is to drag and drop the files to a target folder.

taboca@d2d82b7

from chromeless.

mikedeboer avatar mikedeboer commented on May 27, 2024

@taboca thanks for the update! I know why it's not working... you can not mix and match the 'HTML 5' (built-in to firefox/ xulrunner and exposed as accessible API to the browser chrome) native drag/drop and the XUL/ XPCOM based solution. You have to choose one of the two. Prism has implemented the XPCOM solution. It's all JS and - with a little work - portable to chromeless, so check it out!

from chromeless.

taboca avatar taboca commented on May 27, 2024

@mike I did check in an initial case SHA: 8ce7f28 that shows a basic function for a file drop. This testcase, for now, creates a copy of the file in the target folder. It's all under misc.js and our code gets called when the drop happens: we get notified about the target folder name which user attempted to drop the div.

from chromeless.

mikedeboer avatar mikedeboer commented on May 27, 2024

@taboca awesome! I reviewed the code in the commit and it looks good!
One thing: I do not think that putting the functions in misc.js is a good idea - why not put them in dragdrop.js? This way the end-user/ dev knows better what to include when he or she is implementing drag/drop with Chromeless.
I'll check it out and implement it into Cloud9!

from chromeless.

taboca avatar taboca commented on May 27, 2024

@mike, @lloyd,

Thanks, and yes -- agree with points. So a design plan for a polish update:

  • Move to a dragdrop.js -- fix the documentation too -- I accidentally took out Lloyd's documentation ( comments ) framework from the code;
  • Developer's ability to associate the expectation = success or error = as callback in user's JavaScript. The reasoning here is that a developer may prepare a case where user can drag and drop, but user may accidentally drop to the same browser area, or drop to an area that is not a valid OS receiver. If things ok, if the writing happens, we call developer's success function, ortherwise we call error callback.
  • For now we support files, but we keep some code design annotation on next steps for folder. It should be developer's job to inform type=file or folder. We would support type==file for now.
  • Move the dragdrop ( out to folder ) sample aspect to Mike's example app, and keep ./test more simplified.

from chromeless.

taboca avatar taboca commented on May 27, 2024

SHA: fcbcb1d

from chromeless.

lloyd avatar lloyd commented on May 27, 2024

I just tested this locally with chromeless tests/dragdrop/index.html. looks good, closing. if for some reason this needs to be kept open, please re-open.

from chromeless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.