diff options
Diffstat (limited to 'src/webview/contextMenuBuilder.js')
-rw-r--r-- | src/webview/contextMenuBuilder.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js index 7c178145d..c26f192fe 100644 --- a/src/webview/contextMenuBuilder.js +++ b/src/webview/contextMenuBuilder.js | |||
@@ -161,7 +161,7 @@ module.exports = class ContextMenuBuilder { | |||
161 | // Omit the mailto: portion of the link; we just want the address | 161 | // Omit the mailto: portion of the link; we just want the address |
162 | const url = isEmailAddress ? menuInfo.linkText : menuInfo.linkURL; | 162 | const url = isEmailAddress ? menuInfo.linkText : menuInfo.linkURL; |
163 | clipboard.writeText(url); | 163 | clipboard.writeText(url); |
164 | this.sendNotificationOnClipboardEvent(`Link URL copied: ${url}`); | 164 | this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Link URL copied: ${url}`); |
165 | }, | 165 | }, |
166 | }); | 166 | }); |
167 | 167 | ||
@@ -321,7 +321,7 @@ module.exports = class ContextMenuBuilder { | |||
321 | const result = this.convertImageToBase64(menuInfo.srcURL, | 321 | const result = this.convertImageToBase64(menuInfo.srcURL, |
322 | dataURL => clipboard.writeImage(nativeImage.createFromDataURL(dataURL))); | 322 | dataURL => clipboard.writeImage(nativeImage.createFromDataURL(dataURL))); |
323 | 323 | ||
324 | this.sendNotificationOnClipboardEvent(`Image copied from URL: ${menuInfo.srcURL}`); | 324 | this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image copied from URL: ${menuInfo.srcURL}`); |
325 | return result; | 325 | return result; |
326 | }, | 326 | }, |
327 | }); | 327 | }); |
@@ -332,7 +332,7 @@ module.exports = class ContextMenuBuilder { | |||
332 | label: this.stringTable.copyImageUrl(), | 332 | label: this.stringTable.copyImageUrl(), |
333 | click: () => { | 333 | click: () => { |
334 | const result = clipboard.writeText(menuInfo.srcURL); | 334 | const result = clipboard.writeText(menuInfo.srcURL); |
335 | this.sendNotificationOnClipboardEvent(`Image URL copied: ${menuInfo.srcURL}`); | 335 | this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image URL copied: ${menuInfo.srcURL}`); |
336 | return result; | 336 | return result; |
337 | }, | 337 | }, |
338 | }); | 338 | }); |
@@ -357,7 +357,7 @@ module.exports = class ContextMenuBuilder { | |||
357 | }, | 357 | }, |
358 | }); | 358 | }); |
359 | }); | 359 | }); |
360 | this.sendNotificationOnClipboardEvent(`Image downloaded: ${urlWithoutBlob}`); | 360 | this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image downloaded: ${urlWithoutBlob}`); |
361 | }, | 361 | }, |
362 | }); | 362 | }); |
363 | 363 | ||
@@ -520,7 +520,7 @@ module.exports = class ContextMenuBuilder { | |||
520 | enabled: true, | 520 | enabled: true, |
521 | click: () => { | 521 | click: () => { |
522 | clipboard.writeText(window.location.href); | 522 | clipboard.writeText(window.location.href); |
523 | this.sendNotificationOnClipboardEvent(`Page URL copied: ${window.location.href}`); | 523 | this._sendNotificationOnClipboardEvent(menu.clipboardNotifications, () => `Page URL copied: ${window.location.href}`); |
524 | }, | 524 | }, |
525 | })); | 525 | })); |
526 | 526 | ||
@@ -560,11 +560,14 @@ module.exports = class ContextMenuBuilder { | |||
560 | return menu; | 560 | return menu; |
561 | } | 561 | } |
562 | 562 | ||
563 | sendNotificationOnClipboardEvent(notificationText) { | 563 | _sendNotificationOnClipboardEvent(isDisabled, notificationText) { |
564 | if (isDisabled) { | ||
565 | return; | ||
566 | } | ||
564 | // eslint-disable-next-line no-new | 567 | // eslint-disable-next-line no-new |
565 | new window.Notification('Data copied into Clipboard', | 568 | new window.Notification('Data copied into Clipboard', |
566 | { | 569 | { |
567 | body: notificationText, | 570 | body: notificationText(), |
568 | }); | 571 | }); |
569 | } | 572 | } |
570 | }; | 573 | }; |