stuff
This commit is contained in:
2
cinny
2
cinny
Submodule cinny updated: b185e0b129...30a7725769
@@ -326,12 +326,12 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
}, { useSystemPicker: false });
|
}, { useSystemPicker: false });
|
||||||
|
|
||||||
// Disable default context menu, only show for text selection
|
// Disable default context menu, only show for text selection and images
|
||||||
mainWindow.webContents.on('context-menu', (event, params) => {
|
mainWindow.webContents.on('context-menu', (event, params) => {
|
||||||
const { selectionText, isEditable } = params;
|
const { selectionText, isEditable, mediaType, srcURL } = params;
|
||||||
|
|
||||||
// Only show context menu if there's selected text or in an editable field
|
// Show context menu for text selection, editable fields, or images
|
||||||
if (selectionText || isEditable) {
|
if (selectionText || isEditable || mediaType === 'image') {
|
||||||
// Build a minimal menu for text operations
|
// Build a minimal menu for text operations
|
||||||
const template = [];
|
const template = [];
|
||||||
|
|
||||||
@@ -348,6 +348,27 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Image context menu options
|
||||||
|
if (mediaType === 'image' && srcURL) {
|
||||||
|
template.push(
|
||||||
|
{
|
||||||
|
label: 'Copy Image',
|
||||||
|
click: () => {
|
||||||
|
mainWindow.webContents.copyImageAt(params.x, params.y);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Save Image As...',
|
||||||
|
click: () => {
|
||||||
|
mainWindow.webContents.downloadURL(srcURL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (selectionText) {
|
||||||
|
template.push({ type: 'separator' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (selectionText) {
|
if (selectionText) {
|
||||||
template.push(
|
template.push(
|
||||||
{
|
{
|
||||||
@@ -392,7 +413,7 @@ function createWindow() {
|
|||||||
menu.popup(mainWindow);
|
menu.popup(mainWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If no text selected and not editable, suppress the context menu entirely
|
// If no text selected, not editable, and not an image, suppress the context menu entirely
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load the app
|
// Load the app
|
||||||
|
|||||||
Reference in New Issue
Block a user