- From: Sebastian Markbåge <sebastian@calyptus.eu>
- Date: Fri, 24 Aug 2012 18:52:54 +0200
- To: "Hallvord R. M. Steen" <hallvord@opera.com>
- Cc: public-webapps <public-webapps@w3.org>, Ryosuke Niwa <rniwa@webkit.org>, Aryeh Gregor <ayg@aryeh.name>, Daniel Cheng <dcheng@chromium.org>
>> We (Google) would like to propose to add a boolean flag indicating whether >> the user intended to paste as plain text or rich text. > > Perhaps we can add event.clipboardData.intendedType ? I.e. > > if( event.clipboardData.intendedType=='text/plain' ){ > // user used "paste as text" command > }else{ > > } It would be better if the UA could negotiate the type. E.g. onbeforepaste = function(event){ event.clipboardData.typesAllowed = ['text/plain', 'text/html']; } The UA can then present a paste menu with the options to paste as plain text or HTML. The UA can then choose to exclude any type that is not "intended". The UA can also include all types if no intention was made. If the user chooses plain text, only plain text is included. onpaste = function(event){ event.clipboardData.types; // ['text/plain'] } The UA should also include clipboardData.types in the onbeforepaste event to indicate what is available. To allow anything BUT text/plain the web page could something like this: onbeforepaste = function(event){ event.clipboardData.typesAllowed = event.clipboardData.types.filter((type) => type != 'text/plain'); }
Received on Friday, 24 August 2012 16:53:22 UTC