Added "open split view in new tab" context menu button

This commit is contained in:
Mauro Balades 2024-08-22 16:11:28 +02:00
parent fbf63e4bc1
commit dcea272d88

View file

@ -10,6 +10,19 @@ var gZenViewSplitter = new class {
window.addEventListener("TabClose", this.handleTabClose.bind(this)); window.addEventListener("TabClose", this.handleTabClose.bind(this));
this.initializeContextMenu(); this.initializeContextMenu();
this.insertPageActionButton(); this.insertPageActionButton();
this.insertIntoContextMenu();
}
insertIntoContextMenu() {
const sibling = document.getElementById("context-stripOnShareLink");
const menuitem = document.createXULElement("menuitem");
menuitem.setAttribute("id", "context-zenSplitLink");
menuitem.setAttribute("hidden", "true");
menuitem.setAttribute("oncommand", "gZenViewSplitter.splitLinkInNewTab();");
menuitem.setAttribute("data-l10n-id", "zen-split-link");
sibling.insertAdjacentElement("afterend", document.createXULElement("menuseparator"));
sibling.insertAdjacentElement("afterend", menuitem);
sibling.insertAdjacentElement("afterend", document.createXULElement("menuseparator"));
} }
/** /**
@ -567,8 +580,7 @@ var gZenViewSplitter = new class {
return; return;
} }
if (this.currentView >= 0) { if (this.currentView >= 0) {
this._data[this.currentView].gridType = gridType; return;
this.updateSplitView(window.gBrowser.selectedTab);
} }
const tabs = gBrowser.tabs; const tabs = gBrowser.tabs;
if (tabs.length < 2) { if (tabs.length < 2) {