mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
SDA-3094: Listen to copy image event (#2026)
This commit is contained in:
parent
756516ca87
commit
31ebada917
@ -379,7 +379,10 @@ export class ContextMenuBuilder {
|
|||||||
const target = this.getWebContents();
|
const target = this.getWebContents();
|
||||||
const copyImage = new MenuItem({
|
const copyImage = new MenuItem({
|
||||||
label: this.stringTable.copyImage(),
|
label: this.stringTable.copyImage(),
|
||||||
click: () => target.copyImageAt(menuInfo.x, menuInfo.y),
|
click: (_e) => {
|
||||||
|
logger.info('Context-Menu-Builder: Copy Image to clipboard');
|
||||||
|
target.send('copy-to-clipboard', menuInfo.srcURL);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.append(copyImage);
|
menu.append(copyImage);
|
||||||
|
@ -14,6 +14,7 @@ export enum apiCmds {
|
|||||||
sendLogs = 'send-logs',
|
sendLogs = 'send-logs',
|
||||||
addLogs = 'add-logs',
|
addLogs = 'add-logs',
|
||||||
registerAnalyticsHandler = 'register-analytics-handler',
|
registerAnalyticsHandler = 'register-analytics-handler',
|
||||||
|
registerWriteImageToClipboard = 'register-write-image-to-clipboard',
|
||||||
registerActivityDetection = 'register-activity-detection',
|
registerActivityDetection = 'register-activity-detection',
|
||||||
showNotificationSettings = 'show-notification-settings',
|
showNotificationSettings = 'show-notification-settings',
|
||||||
sanitize = 'sanitize',
|
sanitize = 'sanitize',
|
||||||
|
@ -68,6 +68,7 @@ if (ssfWindow.ssf) {
|
|||||||
sendLogs: ssfWindow.ssf.sendLogs,
|
sendLogs: ssfWindow.ssf.sendLogs,
|
||||||
addLogs: ssfWindow.ssf.addLogs,
|
addLogs: ssfWindow.ssf.addLogs,
|
||||||
registerAnalyticsEvent: ssfWindow.ssf.registerAnalyticsEvent,
|
registerAnalyticsEvent: ssfWindow.ssf.registerAnalyticsEvent,
|
||||||
|
registerWriteImageToClipboard: ssfWindow.ssf.registerWriteImageToClipboard,
|
||||||
ScreenSnippet: ssfWindow.ssf.ScreenSnippet,
|
ScreenSnippet: ssfWindow.ssf.ScreenSnippet,
|
||||||
openScreenSnippet: ssfWindow.ssf.openScreenSnippet,
|
openScreenSnippet: ssfWindow.ssf.openScreenSnippet,
|
||||||
closeScreenSnippet: ssfWindow.ssf.closeScreenSnippet,
|
closeScreenSnippet: ssfWindow.ssf.closeScreenSnippet,
|
||||||
|
@ -66,6 +66,7 @@ export interface ILocalObject {
|
|||||||
c9MessageCallback?: (status: IShellStatus) => void;
|
c9MessageCallback?: (status: IShellStatus) => void;
|
||||||
updateMyPresenceCallback?: (presence: EPresenceStatusCategory) => void;
|
updateMyPresenceCallback?: (presence: EPresenceStatusCategory) => void;
|
||||||
phoneNumberCallback?: (arg: string) => void;
|
phoneNumberCallback?: (arg: string) => void;
|
||||||
|
writeImageToClipboard?: (blob: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const local: ILocalObject = {
|
const local: ILocalObject = {
|
||||||
@ -384,6 +385,17 @@ export class SSFApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register Event to expose callback when Copy Image is clicked
|
||||||
|
*
|
||||||
|
* @param analyticsEventHandler
|
||||||
|
*/
|
||||||
|
public registerWriteImageToClipboard(callback): void {
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
local.writeImageToClipboard = callback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose old screen snippet api to support backward compatibility
|
* Expose old screen snippet api to support backward compatibility
|
||||||
*
|
*
|
||||||
@ -1025,6 +1037,15 @@ local.ipcRenderer.on(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
local.ipcRenderer.on(
|
||||||
|
'copy-to-clipboard',
|
||||||
|
async (_event: Event, arg: string) => {
|
||||||
|
if (typeof local.writeImageToClipboard === 'function') {
|
||||||
|
local.writeImageToClipboard(arg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event triggered by the main process
|
* An event triggered by the main process
|
||||||
* when the snippet is complete
|
* when the snippet is complete
|
||||||
|
Loading…
Reference in New Issue
Block a user