Edit > Copy To...
parent
a5f912b588
commit
d2c15bef4b
4
TODO.md
4
TODO.md
|
@ -28,7 +28,7 @@
|
|||
* Print Preview
|
||||
* Page Setup
|
||||
* Edit
|
||||
* Copy To...
|
||||
* Cut, Copy, Paste: Possibly impossible
|
||||
* View
|
||||
* Show/Hide stuff
|
||||
* Zoom should have a submenu
|
||||
|
@ -41,7 +41,7 @@
|
|||
* Help
|
||||
* Help Topics ✓ um...
|
||||
* About paint ✓ um......
|
||||
* Enable items (Repeat, Clear Selection) when they are applicable
|
||||
* Enable items (Repeat, Clear Selection, Copy To...) when they are applicable
|
||||
* Animation
|
||||
|
||||
|
||||
|
|
33
src/menus.js
33
src/menus.js
|
@ -146,6 +146,36 @@ var set_as_wallpaper_centered = function(c){
|
|||
}
|
||||
};
|
||||
|
||||
var save_selection_to_file = function(){
|
||||
if(selection && selection.canvas){
|
||||
if(window.chrome && chrome.fileSystem && chrome.fileSystem.chooseEntry){
|
||||
chrome.fileSystem.chooseEntry({
|
||||
type: 'saveFile',
|
||||
suggestedName: 'Selection',
|
||||
accepts: [{mimeTypes: ["image/*"]}]
|
||||
}, function(entry){
|
||||
if(chrome.runtime.lastError){
|
||||
return console.error(chrome.runtime.lastError.message);
|
||||
}
|
||||
entry.createWriter(function(file_writer){
|
||||
file_writer.onwriteend = function(e){
|
||||
if(this.error){
|
||||
console.error(this.error + '\n\n\n@ ' + e);
|
||||
}else{
|
||||
console.log("Wrote selection to file!");
|
||||
}
|
||||
};
|
||||
selection.canvas.toBlob(function(blob){
|
||||
file_writer.write(blob);
|
||||
});
|
||||
});
|
||||
});
|
||||
}else{
|
||||
window.open(selection.canvas.toDataURL());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.each({
|
||||
"&File": [
|
||||
{
|
||||
|
@ -245,7 +275,8 @@ $.each({
|
|||
____________________________,
|
||||
{
|
||||
item: "C&opy To...",
|
||||
disabled: true
|
||||
disabled: true,
|
||||
action: save_selection_to_file
|
||||
},
|
||||
{
|
||||
item: "Paste &From...",
|
||||
|
|
Loading…
Reference in New Issue