Last Comment Bug 73286 - Paste Special feature have clipboard "flavors"
: Paste Special feature have clipboard "flavors"
Status: NEW
[behavior]
: helpwanted
Product: SeaMonkey
Classification: Client Software
Component: Composer (show other bugs)
: Trunk
: All All
: -- enhancement with 2 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks: 41547
  Show dependency treegraph
 
Reported: 2001-03-23 18:34 PST by Charles Manske
Modified: 2012-11-01 15:10 PDT (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Charles Manske 2001-03-23 18:34:23 PST
We want to supply a "Paste Special" submenu that lets a user select what
clipboard flavor to use when multiple flavors exist in clipboard data.
So we need to be able to obtain the list of all flavors currently available in
clipboard data.
Comment 1 Charles Manske 2001-03-23 18:36:28 PST
Setting milestone to the same as bug 41547, although both may be moved to 0.9.1
if needed.

Comment 2 rubydoo123 2001-04-03 16:49:37 PDT
moving to mozilla1.0
Comment 3 Charles Manske 2001-05-14 13:12:34 PDT
Since UI is checked in, beppe said it's ok to work on this for 0.9.2 (0.9.1
would be even better) if we have the time.
Comment 4 rubydoo123 2001-06-05 17:04:55 PDT
actually, moving this back to 1.0
Comment 5 Syd Logan 2001-09-12 13:29:33 PDT
spam composer change
Comment 6 Kathleen Brade 2001-09-17 13:18:35 PDT
-->future
We aren't working on new features right now.

note to self: I think this needs to be done in c++
Comment 7 Robert Kaiser 2009-06-14 08:38:58 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 8 Robert Kaiser 2009-06-14 08:44:06 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 9 Robert Kaiser 2009-06-14 08:50:39 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 10 Robert Kaiser 2009-06-14 09:51:11 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 11 Robert Kaiser 2009-06-14 09:58:02 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 12 Robert Kaiser 2009-06-14 18:38:47 PDT
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Comment 13 Harald 2009-09-26 10:42:29 PDT
I'm not sure if FF 3.53 belongs to this group
(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729))

Some days ago I came across the same probem.
I tried this:
var gClipboard = Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
const kClipboardIID = Components.interfaces.nsIClipboard;
gClipboard.getData(trans, gClipboard.kGlobalClipboard );
var allFlavours=trans.flavorsTransferableCanExport ( ) ;

Expecting to get a list of all flavours on the cliboard being able to chose the best one.

After playing around a few hours, the best solution I found is to create a list of flavours and check each one by one.

var ClipboardMimeTypes= new Array(
 "text/html"
,"text/plain"
,"text/unicode"
,"AOLMAIL"
,"image/png"
,"image/jpg"
,"image/gif"
,"application/x-moz-file"
,"text/x-moz-url"
,"text/x-moz-url-data"
,"text/x-moz-url-desc"   // data contains description
,"text/x-moz-url-priv"   // same as kURLDataMime but for private uses
,"application/x-moz-nativeimage"
,"application/x-moz-nativehtml"
,"application/x-moz-file-promise-url"
,"application/x-moz-file-promise-dest-filename"
,"application/x-moz-file-promise"
,"application/x-moz-file-promise-dir"
);

function getClipboardFlavours()
{
  var L=new Array();
  var gClipboard = Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);
  const kClipboardIID = Components.interfaces.nsIClipboard;
  var length = {}, data = {}, flavour={};
    for(var f=0; f<ClipboardMimeTypes.length; f++)
{
  var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
    trans.addDataFlavor(ClipboardMimeTypes[f]);
  gClipboard.getData(trans, gClipboard.kGlobalClipboard );
 try {    trans.getAnyTransferData (flavour, data, length);
  L.push(flavour.value);
  // log(flavour.value," ", data.value," ", length.value);
} catch(e) {}
}
  return L;
}

getClipboardFlavours();


The main problem I found is that nsClipboard::GetDataFromDataObject
(http://mxr.mozilla.org/mozilla/source/widget/src/windows/nsClipboard.cpp#565)
breaks after the first hit, thus its impossible to get more than one flavour at a time.
Comment 14 rsx11m 2012-06-02 17:09:58 PDT
I'm reconfirming this, though I'm not sure if this should stay in SeaMonkey or rather be moved to Core/Editor given that the backend first must support it before any UI can be added for either Composer or MailNews: Composition components.

By default, an HTML representation is preferred over a bitmap representation, which may not be what the user intended:

 - The HTML encoding may be incomplete and doesn't fully reflect the appearance
   of the object to be pasted, in which case pasting as a bitmap might be better.

 - The HTML encoding may not be valid outside of the scope of a specific context,
   e.g., when copying part of a web page which requires authentication or relies
   on specific cookies being set, thus resulting in a broken link for an image.

Thus, expanding on comment #13, pasting would require a getClipboardFlavours() function to be run first which can then populate a Paste Special or Paste As item in the Edit menu from which the user can explicitly choose the desired flavor for the pasting function from a submenu. This could also replace/incorporate the Paste Without Format and (for MailNews) Paste As Quotation items in the same menu.

Note You need to log in before you can comment on or make changes to this bug.