Closed
Bug 1325759
Opened 8 years ago
Closed 7 years ago
Copy image binary content as well as URL
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1356543
People
(Reporter: bugzilla, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [design-decision-approved])
The WebExtension API documentation[1] for Document.execCommand() makes it look as though it's possible to add text to the clipboard via execCommand('copy'). However, I can see no way of copying the actual binary data of an image; i.e. as per the "Copy Image" item from the context menu.
As part of porting the Image Toolbar add-on, I would like a way to continue to offer this functionality.
Note: Some discussions online propose using canvas to extract a dataURL, that's not really an acceptable solution. It's very useful to be able to copy images and paste into an image editor, document editor, etc.
[1]: https://developer.mozilla.org/en/docs/Web/API/Document/execCommand
Reporter | ||
Comment 1•8 years ago
|
||
I should add, currently using the following to copy both image content and URL simultaneously:
> var param = Components.classes["@mozilla.org/embedcomp/command-params;1"]
> .createInstance(Components.interfaces.nsICommandParams);
> param.setLongValue("imageCopy", Components.interfaces.nsIContentViewerEdit.COPY_IMAGE_ALL);
> document.commandDispatcher.getControllerForCommand("cmd_copyImage")
> .QueryInterface(Components.interfaces.nsICommandController)
> .doCommandWithParams("cmd_copyImage", param);
Reporter | ||
Comment 2•8 years ago
|
||
Presumably execCommand could be overloaded to optionally take a pageAction.ImageDataType or something like that?
Reporter | ||
Comment 3•8 years ago
|
||
Sorry for bugspam, ignore comment 2, I don't know what I'm talking about. pageAction is not what I thought it was :-)
Updated•8 years ago
|
Whiteboard: [design-decision-needed] triaged
Comment 4•7 years ago
|
||
Hi Ben, this has been added to the agenda for the June 6 WebExtension APIs triage meeting. I hope you'll be able to join us!
Agenda: https://docs.google.com/document/d/1pTNjK5i_8gHt3EeiUiu5KCUVeRcfwn7ybCPDBSx6CLM/edit#heading=h.34n4lirhljve
Updated•7 years ago
|
Flags: needinfo?(amckay)
Reporter | ||
Comment 5•7 years ago
|
||
I note the following triage meeting comments:
> Andy to investigate why Chrome deprecated this and then removed
> Unclear about how to implement this in Firefox
Not sure about Chrome, but it's interesting that Firefox also has these as separate context menu items these days ("Copy Image" and "Copy Image Location"). IIRC the Firefox context menu used to have a single item that performed both functions as well. It might be easier to find out why Firefox changed (I assume it's all here in Bugzilla somewhere).
Comment 6•7 years ago
|
||
I think we need to support this and make clipboard manipulation as easy as possible. It's possible we could do dupe this over to bug 1344410 or one of the many other bugs around clipboard.
My chrome deprecation comment was referring to bug 1344410.
Flags: needinfo?(amckay)
Updated•7 years ago
|
Whiteboard: [design-decision-needed] triaged → [design-decision-approved][triaged]
Updated•7 years ago
|
Whiteboard: [design-decision-approved][triaged] → [design-decision-approved]
Comment 7•7 years ago
|
||
Is this the same with bug 1356543?
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•