copy all urls in split view

This commit is contained in:
EmilyxFox
2025-02-01 23:24:21 +01:00
parent e39419af25
commit 9bad51b94e
2 changed files with 14 additions and 3 deletions

View File

@@ -60,10 +60,12 @@ class ZenPreloadedFeature {
var gZenCommonActions = {
copyCurrentURLToClipboard() {
const currentUrl = gBrowser.currentURI.spec;
if (currentUrl) {
const currentTabs = gZenViewSplitter.getTabsInCurrentView()
if (currentTabs) {
const stringArray = currentTabs.map(t => `${t.linkedBrowser.currentURI.spec}`)
const markdownString = stringArray.join("\n")
let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString);
str.data = currentUrl;
str.data = markdownString;
let transferable = Cc['@mozilla.org/widget/transferable;1'].createInstance(Ci.nsITransferable);
transferable.init(getLoadContext());
transferable.addDataFlavor('text/plain');

View File

@@ -1136,6 +1136,15 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
: [gBrowser.selectedTab, tabs[nextTabIndex]];
this.splitTabs(selected_tabs, gridType);
}
/**
* Gets all the tabs in the current view.
* @returns {Tab[]} The tabs in the current view.
*/
getTabsInCurrentView() {
if (this.currentView < 0) return [gBrowser.selectedTab];
return this._data[this.currentView].tabs;
}
}
window.gZenViewSplitter = new ZenViewSplitter();