chore: Add Open Link in Glance option to context menu, p=#11241

* Update zen-general.ftl

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>

* Update nsContextMenu-sys-mjs.patch

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>

* Update ZenGlanceManager.mjs

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>

* Update zen-general.ftl

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>

* Update ZenGlanceManager.mjs

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>

* chore: Cleanup and fix patches, b=no-bug, c=glance

---------

Signed-off-by: devdinc <a-mail-for+profesional-github@proton.me>
Co-authored-by: mr. m <mr.m@tuta.com>
This commit is contained in:
devdinc
2025-11-11 12:53:25 +03:00
committed by GitHub
parent fc804acdb0
commit 8b64925407
3 changed files with 21 additions and 5 deletions

View File

@@ -116,3 +116,7 @@ zen-site-data-setting-site-protection = Tracking Protection
zen-site-data-panel-feature-callout-title = A new home for add-ons, permissions, and more
zen-site-data-panel-feature-callout-subtitle = Click the icon to manage site settings, view security info, access extensions, and perform common actions.
zen-open-link-in-glance =
.label = Open Link in Glance
.accesskey = G

View File

@@ -1,13 +1,13 @@
diff --git a/browser/base/content/nsContextMenu.sys.mjs b/browser/base/content/nsContextMenu.sys.mjs
index 259b440375c7e84d373a134fea20cdbc1c1bae4b..a9ce22a2391b4ec0bf82ceedd35f4c9d9626bb28 100644
index 259b440375c7e84d373a134fea20cdbc1c1bae4b..c4a251f0169d22186c2766992ab40366d53582f1 100644
--- a/browser/base/content/nsContextMenu.sys.mjs
+++ b/browser/base/content/nsContextMenu.sys.mjs
@@ -1104,6 +1104,8 @@ export class nsContextMenu {
@@ -1103,6 +1103,8 @@ export class nsContextMenu {
!this.onMozExtLink &&
!this.isSecureAboutPage()
);
+ this.showItem("context-zenSplitLink", this.onLink && !this.onMailtoLink && !this.onTelLink);
+
+ this.showItem("context-zenOpenLinkInGlance", this.onLink && !this.onMailtoLink && !this.onTelLink);
let canNotStrip =
lazy.STRIP_ON_SHARE_CAN_DISABLE && !this.#canStripParams();

View File

@@ -40,6 +40,7 @@
this.#setupEventListeners();
this.#setupPreferences();
this.#setupObservers();
this.#insertIntoContextMenu();
}
#setupEventListeners() {
@@ -64,6 +65,17 @@
Services.obs.addObserver(this, 'quit-application-requested');
}
#insertIntoContextMenu() {
const menuitem = document.createXULElement('menuitem');
menuitem.setAttribute('id', 'context-zenOpenLinkInGlance');
menuitem.setAttribute('hidden', 'true');
menuitem.setAttribute('data-l10n-id', 'zen-open-link-in-glance');
menuitem.addEventListener('command', () => this.openGlance({ url: gContextMenu.linkURL }));
document.getElementById('context-sep-open').insertAdjacentElement('beforebegin', menuitem);
}
/**
* Handle main command set events for glance operations
* @param {Event} event - The command event