Open Bug 73286 Opened 23 years ago Updated 12 years ago

Paste Special feature have clipboard "flavors"

Categories

(SeaMonkey :: Composer, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

People

(Reporter: cmanske, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: helpwanted, Whiteboard: [behavior])

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.
Blocks: 41547
Setting milestone to the same as bug 41547, although both may be moved to 0.9.1
if needed.

Summary: We need ability to query for clipboard "flavors" from JavaScript → We need ability to query for clipboard "flavors" from JavaScript
Target Milestone: --- → mozilla0.9
Summary: We need ability to query for clipboard "flavors" from JavaScript → Paste Special feature have clipboard "flavors"
moving to mozilla1.0
Priority: -- → P4
Target Milestone: mozilla0.9 → mozilla1.0
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.
Target Milestone: mozilla1.0 → mozilla0.9.2
Priority: P4 → P3
Whiteboard: [behavior]
actually, moving this back to 1.0
Target Milestone: mozilla0.9.2 → mozilla1.0
spam composer change
Component: Editor: Core → Editor: Composer
-->future
We aren't working on new features right now.

note to self: I think this needs to be done in c++
Status: NEW → ASSIGNED
Keywords: helpwanted
Target Milestone: mozilla1.0 → Future
Product: Browser → Seamonkey
Severity: normal → enhancement
Assignee: brade → nobody
Status: ASSIGNED → NEW
Priority: P3 → --
QA Contact: sujay → composer
Target Milestone: Future → ---
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
Status: NEW → UNCONFIRMED
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
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
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
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
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
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.
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.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows NT → All
You need to log in before you can comment on or make changes to this bug.