Skip to content

Commit 8b64925

Browse files
devdincmr-cheffy
andauthored
chore: Add Open Link in Glance option to context menu, p=#11241
* Update zen-general.ftl Signed-off-by: devdinc <[email protected]> * Update nsContextMenu-sys-mjs.patch Signed-off-by: devdinc <[email protected]> * Update ZenGlanceManager.mjs Signed-off-by: devdinc <[email protected]> * Update zen-general.ftl Signed-off-by: devdinc <[email protected]> * Update ZenGlanceManager.mjs Signed-off-by: devdinc <[email protected]> * chore: Cleanup and fix patches, b=no-bug, c=glance --------- Signed-off-by: devdinc <[email protected]> Co-authored-by: mr. m <[email protected]>
1 parent fc804ac commit 8b64925

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

locales/en-US/browser/browser/zen-general.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,7 @@ zen-site-data-setting-site-protection = Tracking Protection
116116

117117
zen-site-data-panel-feature-callout-title = A new home for add-ons, permissions, and more
118118
zen-site-data-panel-feature-callout-subtitle = Click the icon to manage site settings, view security info, access extensions, and perform common actions.
119+
120+
zen-open-link-in-glance =
121+
.label = Open Link in Glance
122+
.accesskey = G
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
diff --git a/browser/base/content/nsContextMenu.sys.mjs b/browser/base/content/nsContextMenu.sys.mjs
2-
index 259b440375c7e84d373a134fea20cdbc1c1bae4b..a9ce22a2391b4ec0bf82ceedd35f4c9d9626bb28 100644
2+
index 259b440375c7e84d373a134fea20cdbc1c1bae4b..c4a251f0169d22186c2766992ab40366d53582f1 100644
33
--- a/browser/base/content/nsContextMenu.sys.mjs
44
+++ b/browser/base/content/nsContextMenu.sys.mjs
5-
@@ -1104,6 +1104,8 @@ export class nsContextMenu {
5+
@@ -1103,6 +1103,8 @@ export class nsContextMenu {
6+
!this.onMozExtLink &&
67
!this.isSecureAboutPage()
78
);
8-
99
+ this.showItem("context-zenSplitLink", this.onLink && !this.onMailtoLink && !this.onTelLink);
10-
+
10+
+ this.showItem("context-zenOpenLinkInGlance", this.onLink && !this.onMailtoLink && !this.onTelLink);
11+
1112
let canNotStrip =
1213
lazy.STRIP_ON_SHARE_CAN_DISABLE && !this.#canStripParams();
13-

src/zen/glance/ZenGlanceManager.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
this.#setupEventListeners();
4141
this.#setupPreferences();
4242
this.#setupObservers();
43+
this.#insertIntoContextMenu();
4344
}
4445

4546
#setupEventListeners() {
@@ -64,6 +65,17 @@
6465
Services.obs.addObserver(this, 'quit-application-requested');
6566
}
6667

68+
#insertIntoContextMenu() {
69+
const menuitem = document.createXULElement('menuitem');
70+
menuitem.setAttribute('id', 'context-zenOpenLinkInGlance');
71+
menuitem.setAttribute('hidden', 'true');
72+
menuitem.setAttribute('data-l10n-id', 'zen-open-link-in-glance');
73+
74+
menuitem.addEventListener('command', () => this.openGlance({ url: gContextMenu.linkURL }));
75+
76+
document.getElementById('context-sep-open').insertAdjacentElement('beforebegin', menuitem);
77+
}
78+
6779
/**
6880
* Handle main command set events for glance operations
6981
* @param {Event} event - The command event

0 commit comments

Comments
 (0)