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 copyImage = new MenuItem({
|
||||
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);
|
||||
|
@ -14,6 +14,7 @@ export enum apiCmds {
|
||||
sendLogs = 'send-logs',
|
||||
addLogs = 'add-logs',
|
||||
registerAnalyticsHandler = 'register-analytics-handler',
|
||||
registerWriteImageToClipboard = 'register-write-image-to-clipboard',
|
||||
registerActivityDetection = 'register-activity-detection',
|
||||
showNotificationSettings = 'show-notification-settings',
|
||||
sanitize = 'sanitize',
|
||||
|
@ -68,6 +68,7 @@ if (ssfWindow.ssf) {
|
||||
sendLogs: ssfWindow.ssf.sendLogs,
|
||||
addLogs: ssfWindow.ssf.addLogs,
|
||||
registerAnalyticsEvent: ssfWindow.ssf.registerAnalyticsEvent,
|
||||
registerWriteImageToClipboard: ssfWindow.ssf.registerWriteImageToClipboard,
|
||||
ScreenSnippet: ssfWindow.ssf.ScreenSnippet,
|
||||
openScreenSnippet: ssfWindow.ssf.openScreenSnippet,
|
||||
closeScreenSnippet: ssfWindow.ssf.closeScreenSnippet,
|
||||
|
@ -66,6 +66,7 @@ export interface ILocalObject {
|
||||
c9MessageCallback?: (status: IShellStatus) => void;
|
||||
updateMyPresenceCallback?: (presence: EPresenceStatusCategory) => void;
|
||||
phoneNumberCallback?: (arg: string) => void;
|
||||
writeImageToClipboard?: (blob: string) => void;
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
@ -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
|
||||
* when the snippet is complete
|
||||
|
Loading…
Reference in New Issue
Block a user