diff --git a/src/browser/base/zen-components/ZenCommonUtils.mjs b/src/browser/base/zen-components/ZenCommonUtils.mjs index 16adcee0d..ad4fc1805 100644 --- a/src/browser/base/zen-components/ZenCommonUtils.mjs +++ b/src/browser/base/zen-components/ZenCommonUtils.mjs @@ -73,18 +73,18 @@ var gZenCommonActions = { } }, CopyCurrentURLAsMarkdownToClipboard() { - const currentUrl = gBrowser.currentURI.spec; - const tabTitle = gBrowser.selectedTab.label; - if (currentUrl && tabTitle) { - const markdownLink = `[${tabTitle}](${currentUrl})` - let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString); - str.data = markdownLink; - let transferable = Cc['@mozilla.org/widget/transferable;1'].createInstance(Ci.nsITransferable); - transferable.init(getLoadContext()); - transferable.addDataFlavor('text/plain'); - transferable.setTransferData('text/plain', str); - Services.clipboard.setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); - ConfirmationHint.show(document.getElementById('PanelUI-menu-button'), 'zen-copy-current-url-confirmation'); + const currentTabs = gZenViewSplitter.getTabsInCurrentView() + if (currentTabs) { + const stringArray = currentTabs.map(t => `[${t.label}](${t.linkedBrowser.currentURI.spec})`) + const markdownString = stringArray.join("\n") + let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString); + str.data = markdownString; + let transferable = Cc['@mozilla.org/widget/transferable;1'].createInstance(Ci.nsITransferable); + transferable.init(getLoadContext()); + transferable.addDataFlavor('text/plain'); + transferable.setTransferData('text/plain', str); + Services.clipboard.setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); + ConfirmationHint.show(document.getElementById('PanelUI-menu-button'), 'zen-copy-current-url-confirmation'); } }, diff --git a/src/browser/base/zen-components/ZenKeyboardShortcuts.mjs b/src/browser/base/zen-components/ZenKeyboardShortcuts.mjs index c41273e88..8cd251b42 100644 --- a/src/browser/base/zen-components/ZenKeyboardShortcuts.mjs +++ b/src/browser/base/zen-components/ZenKeyboardShortcuts.mjs @@ -909,19 +909,19 @@ class ZenKeyboardShortcutsVersioner { window.addEventListener('zen-devtools-keyset-added', listener); } if (version < 8) { - // Migrate from 7 to 8 - // In this new version, we add the "Copy URL as Markdown" shortcut to the default shortcuts - data.push( - new KeyShortcut( - 'zen-copy-url-markdown', - 'C', - '', - ZEN_OTHER_SHORTCUTS_GROUP, - KeyShortcutModifiers.fromObject({ accel: true, shift: true, alt: true }), - 'code:gZenCommonActions.CopyCurrentURLAsMarkdownToClipboard()', - 'zen-text-action-copy-url-markdown-shortcut' - ) + // Migrate from 7 to 8 + // In this new version, we add the "Copy URL as Markdown" shortcut to the default shortcuts + data.push( + new KeyShortcut( + 'zen-copy-url-markdown', + 'C', + '', + ZEN_OTHER_SHORTCUTS_GROUP, + KeyShortcutModifiers.fromObject({ accel: true, shift: true, alt: true }), + 'code:gZenCommonActions.CopyCurrentURLAsMarkdownToClipboard()', + 'zen-text-action-copy-url-markdown-shortcut' ) + ) } return data; }