Theseus: image context menu (open / save / copy)
Right-click on an image now offers:
- Open image in new tab -> createTab(srcURL)
- Save image as... -> wc.downloadURL(srcURL). The tab's
will-download handler leaves savePath
unset, so Electron shows the native
Save As dialog and the download appears
in the tracker.
- Copy image -> wc.copyImageAt(x, y). Puts the decoded
image on the clipboard (paste into any
image-aware target).
- Copy image address -> clipboard.writeText(srcURL).
Only shown when p.mediaType === "image" && p.srcURL, so text /
link right-clicks are unchanged.
This commit is contained in:
parent
ace5f7a33e
commit
c6c0f16f9d
1 changed files with 12 additions and 0 deletions
12
main.js
12
main.js
|
|
@ -1299,6 +1299,18 @@ function createTab(initial, opts = {}) {
|
|||
{ type: "separator" },
|
||||
);
|
||||
}
|
||||
// Image context menu: only when the pointer is actually on an image, and
|
||||
// we have a src to act on. Save-image-as triggers will-download with no
|
||||
// preset savePath, so Electron shows the native Save As dialog.
|
||||
if (p.mediaType === "image" && p.srcURL) {
|
||||
items.push(
|
||||
{ label: "Open image in new tab", click: () => createTab(p.srcURL) },
|
||||
{ label: "Save image as…", click: () => wc.downloadURL(p.srcURL) },
|
||||
{ label: "Copy image", click: () => { try { wc.copyImageAt(p.x, p.y); } catch {} } },
|
||||
{ label: "Copy image address", click: () => clipboard.writeText(p.srcURL) },
|
||||
{ type: "separator" },
|
||||
);
|
||||
}
|
||||
if (p.isEditable) items.push({ role: "cut" }, { role: "copy" }, { role: "paste" }, { type: "separator" });
|
||||
else if (p.selectionText) items.push({ role: "copy" }, { type: "separator" });
|
||||
items.push(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue