Re: copy events and content from server

2011-05-18 Thread Hallvord R. M. Steen
On Tue, 17 May 2011 15:50:30 +0900, Paul Libbrecht p...@hoplahup.net  
wrote:



you seem to have not included João Eiras' answer:


Seems I overlooked that indeed. I thought something similar but didn't  
include this, so it's good that João brought it up.



Le 5 mai 2011 à 04:34, João Eiras a écrit :

A synchronous XHR solves this use case and there are no magic locks.


But, couldn't a better solution, not involving locks, be a variation of  
what you suggest:?


  event.clipboardData.pushDataFromRequest(flavour, xhr)


This is actually quite nice, IMO. It avoids imposing limitations on the  
HTTP traffic the way my first suggestion did. Either the script (by  
listening to readystatechange events) or the UA can show some progress  
indication. We also get all the same-origin security limitations and CORS  
(in CORS-supporting UAs) for free.


The main downside I see, is that if the request takes more than a couple  
of seconds to complete, the user might meanwhile have copied something  
that will get overwritten in an unexpected way.


Practically, the other downside is that since we re-use HTML5's  
DataTransfer for clipboardData, this will have to be defined in the HTML  
spec - since it's a new feature I guess that at this point means it will  
go into HTML6, so we won't see it for a while. I think Ian Hickson keeps  
track of such feature requests but I'm not entirely sure how to get it  
onto his list.


I'm surprised to be the only one pushing this considering the huge  
wealth of desktop-like services. Use cases such as copy-a-pdf-fragment  
from Google Docs Drawing, generate a complex ICS, or produce a good  
raster image from a graph-display...


It often seems a bit random what ideas pop up during a standardisation  
process.. :-)


--
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/



Re: copy events and content from server

2011-05-18 Thread Aryeh Gregor
On Wed, May 18, 2011 at 8:10 PM, Hallvord R. M. Steen
hallv...@opera.com wrote:
 Practically, the other downside is that since we re-use HTML5's DataTransfer
 for clipboardData, this will have to be defined in the HTML spec - since
 it's a new feature I guess that at this point means it will go into HTML6,
 so we won't see it for a while. I think Ian Hickson keeps track of such
 feature requests but I'm not entirely sure how to get it onto his list.

New features can still be added freely to the WHATWG's draft of HTML,
which will presumably be the basis of HTML6 when it arrives, and which
implementers can refer to in the meantime.  You can post to
wha...@lists.whatwg.org or file a bug against HTML5 to get on Ian's
list.  I assume that the W3C will want to start publishing HTML6
sooner rather than later, too, because otherwise implementers will be
forced to refer to the WHATWG copy exclusively if they intend to
implement any new features beyond HTML5 (which they will).



Re: copy events and content from server

2011-05-17 Thread Paul Libbrecht
Hallvord,


you seem to have not included João Eiras' answer:

Le 5 mai 2011 à 04:34, João Eiras a écrit :
 A synchronous XHR solves this use case and there are no magic locks.


Although I haven't explicitly tried to implement it and clearly feel it a 
synchronous XHR can block the UI in an ugly way, it can indeed be sufficient.


But, couldn't a better solution, not involving locks, be a variation of what 
you suggest:?

  event.clipboardData.pushDataFromRequest(flavour, xhr)

The big difference is that there is a chance for the user-agent to display that 
his copy action is being process. I think the flavour must stay in the hands of 
the script (as the map media-types - flavors is currently very partial).

I'm surprised to be the only one pushing this considering the huge wealth of 
desktop-like services. Use cases such as copy-a-pdf-fragment from Google Docs 
Drawing, generate a complex ICS, or produce a good raster image from a 
graph-display...

paul

Le 17 mai 2011 à 02:30, Hallvord R. M. Steen a écrit :

 In many of the scenarios I have working for, the content to be put on the 
 clipboard would come from a luxury knowledge structure on the server, one 
 that has access to some semantic source and can infer useful 
 representations out of it; these get put to the clipboard.
 An offline HTML would also be an example of it.
 
 but I am realizing that this is probably not possible to do because the only 
 way to do obtain something from the server is to wait until a callback is 
 called (and this is good so) at which time the copy event might be long gone 
 already.
 
 Indeed.
 
 Would it be thinkable to *lock* the copy event until either a timeout occurs 
 or an unlock is called?
 
 It sounds like a quite advanced use case. I briefly considered something 
 like event.clipboardData.pushContentsOfURL('/foo/bar') but that would be way 
 to limited in options - POST/GET, post data etc. I would like to defer this 
 to later and see if we get more demand for it. Overall, the push for web 
 applications is a lot about removing logic from the server and adding more on 
 the client's side, so I'm unsure how common this state (when the server knows 
 significantly more than the client-side logic about what should be placed on 
 the clipboard) is and will be going forward.




Re: copy events and content from server

2011-05-16 Thread Hallvord R. M. Steen
On Wed, 04 May 2011 02:26:22 +0900, Paul Libbrecht p...@hoplahup.net  
wrote:


In many of the scenarios I have working for, the content to be put on  
the clipboard would come from a luxury knowledge structure on the  
server, one that has access to some semantic source and can infer  
useful representations out of it; these get put to the clipboard.

An offline HTML would also be an example of it.


but I am realizing that this is probably not possible to do because the  
only way to do obtain something from the server is to wait until a  
callback is called (and this is good so) at which time the copy event  
might be long gone already.


Indeed.

Would it be thinkable to *lock* the copy event until either a timeout  
occurs or an unlock is called?


It sounds like a quite advanced use case. I briefly considered something  
like event.clipboardData.pushContentsOfURL('/foo/bar') but that would be  
way to limited in options - POST/GET, post data etc. I would like to defer  
this to later and see if we get more demand for it. Overall, the push for  
web applications is a lot about removing logic from the server and adding  
more on the client's side, so I'm unsure how common this state (when the  
server knows significantly more than the client-side logic about what  
should be placed on the clipboard) is and will be going forward.


--
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/



Re: copy events and content from server

2011-05-04 Thread João Eiras

On , Paul Libbrecht p...@hoplahup.net wrote:



Hello list,

As noted in the thread about security started by Halvord:


In many of the scenarios I have working for, the content to be put on the clipboard would 
come from a luxury knowledge structure on the server, one that has access to 
some semantic source and can infer useful representations out of it; these get put to the 
clipboard.
An offline HTML would also be an example of it.


but I am realizing that this is probably not possible to do because the only 
way to do obtain something from the server is to wait until a callback is 
called (and this is good so) at which time the copy event might be long gone 
already.

Would it be thinkable to *lock* the copy event until either a timeout occurs or 
an unlock is called?

This way the script in the client would be able to fetch rich transformations 
from the server.



A synchronous XHR solves this use case and there are no magic locks.



copy events and content from server

2011-05-03 Thread Paul Libbrecht

Hello list,

As noted in the thread about security started by Halvord:

 In many of the scenarios I have working for, the content to be put on the 
 clipboard would come from a luxury knowledge structure on the server, one 
 that has access to some semantic source and can infer useful representations 
 out of it; these get put to the clipboard. 
 An offline HTML would also be an example of it.

but I am realizing that this is probably not possible to do because the only 
way to do obtain something from the server is to wait until a callback is 
called (and this is good so) at which time the copy event might be long gone 
already.

Would it be thinkable to *lock* the copy event until either a timeout occurs or 
an unlock is called? 

This way the script in the client would be able to fetch rich transformations 
from the server.

thanks in advance.

paul

PS: I would expect the same could be needed for the copy event which could want 
to write to the server.




Re: copy events and content from server

2011-05-03 Thread Ryosuke Niwa
On Tue, May 3, 2011 at 10:26 AM, Paul Libbrecht p...@hoplahup.net wrote:

 As noted in the thread about security started by Halvord:

  In many of the scenarios I have working for, the content to be put on the
 clipboard would come from a luxury knowledge structure on the server, one
 that has access to some semantic source and can infer useful representations
 out of it; these get put to the clipboard.
  An offline HTML would also be an example of it.

 but I am realizing that this is probably not possible to do because the
 only way to do obtain something from the server is to wait until a callback
 is called (and this is good so) at which time the copy event might be long
 gone already.

 Would it be thinkable to *lock* the copy event until either a timeout
 occurs or an unlock is called?


No.  We definitely don't want to lock a local system resource for some
random web service that may potentially fail to release the lock.

- Ryosuke


Re: copy events and content from server

2011-05-03 Thread Paul Libbrecht
Ryosuke,

Le 3 mai 2011 à 21:15, Ryosuke Niwa a écrit :
 Would it be thinkable to *lock* the copy event until either a timeout occurs 
 or an unlock is called?
 No.  We definitely don't want to lock a local system resource for some random 
 web service that may potentially fail to release the lock.


I am not sure I made this clear.
The intent is to let javascript operate a lock.

Locking the system resource? Who spoke about that?
That'd lock maybe some of the continuation of a script in that page... nothing 
else. 
It could start to operate on the clipboard only after the unlock has occurred 
(or a focus-lost has happened which would have declared that the copy operation 
is aborted).

The random web-service in question is the web-server the user is currently 
using which could have delivered the information in question before, just did 
not because it did not know which information the user intended to copy!

If you look at desktop apps, there are many apps that do very rich copy 
operations and these take time with a modal dialog sometimes displayed.

paul