mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
copy all urls in split view
This commit is contained in:
@@ -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');
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user