From 6804f13a8246eb47f09d9887a9d172ed15eda611 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 17 Jul 2021 12:34:51 +0530 Subject: Fixed issue where the 'copy page url' didn't honor silent notifications for clipboard events. --- src/webview/contextMenuBuilder.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js index 500a1a653..63eed2ebe 100644 --- a/src/webview/contextMenuBuilder.js +++ b/src/webview/contextMenuBuilder.js @@ -22,6 +22,7 @@ function matchesWord(string) { return string.match(regex); } +// TODO: Need to externalize for i18n const contextMenuStringTable = { lookUpDefinition: ({ word }) => `Look Up "${word}"`, cut: () => 'Cut', @@ -217,7 +218,7 @@ module.exports = class ContextMenuBuilder { this.addSeparator(menu); this.goBack(menu); this.goForward(menu); - this.copyPageUrl(menu); + this.copyPageUrl(menu, menuInfo); this.goToHomePage(menu, menuInfo); this.openInBrowser(menu, menuInfo); @@ -514,13 +515,13 @@ module.exports = class ContextMenuBuilder { /** * Adds the 'copy page url' menu item. */ - copyPageUrl(menu) { + copyPageUrl(menu, menuInfo) { menu.append(new MenuItem({ label: this.stringTable.copyPageUrl(), enabled: true, click: () => { clipboard.writeText(window.location.href); - this._sendNotificationOnClipboardEvent(menu.clipboardNotifications, () => `Page URL copied: ${window.location.href}`); + this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Page URL copied: ${window.location.href}`); }, })); -- cgit v1.2.3-70-g09d2