diff --git a/.idea/copilot.data.migration.ask2agent.xml b/.idea/copilot.data.migration.ask2agent.xml new file mode 100644 index 00000000..1f2ea11e --- /dev/null +++ b/.idea/copilot.data.migration.ask2agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/git_toolbox_blame.xml b/.idea/git_toolbox_blame.xml new file mode 100644 index 00000000..7dc12496 --- /dev/null +++ b/.idea/git_toolbox_blame.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 00000000..12d5c181 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/docs/History.md b/docs/History.md index b3fe7ab5..129d4249 100644 --- a/docs/History.md +++ b/docs/History.md @@ -1,3 +1,7 @@ +v3.1.15 / 2025-12-27 +==================== +* Fixes link opening behavior to open serially when from multiple actions (@DanKaplanSES) + v3.1.13 / 2024-09-27 ==================== diff --git a/eslint/globals.js b/eslint/globals.js index 73c475a0..380d5047 100644 --- a/eslint/globals.js +++ b/eslint/globals.js @@ -38,6 +38,7 @@ module.exports = { 'BACKGROUND_TEST': 'readonly', 'RELOAD_EXTENSION': 'readonly', 'OPEN_URLS_IN_TABS': 'readonly', + 'COPY_TO_CLIPBOARD': 'readonly', 'OPEN_LINKS': 'readonly', 'COPY_LINKS': 'readonly', 'isChrome': 'readonly', diff --git a/package.json b/package.json index e65a8fb7..7e6c5ea8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name" : "snaplinks3", "FullName" : "Snap Links", - "version" : "3.1.15", + "version" : "3.1.16", "description" : "Select multiple links, checkboxes and other elements and act on them such as open them in new tabs or check/un-check them.", "author" : "Clint Priest ", "license" : "MIT", diff --git a/src/background-scripts/background.js b/src/background-scripts/background.js index 51c2d0b5..30c1ed54 100644 --- a/src/background-scripts/background.js +++ b/src/background-scripts/background.js @@ -1,5 +1,6 @@ 'use strict'; +let openUrlsPromiseChain = Promise.resolve(); let TabStacks = new Map(); /** @@ -30,11 +31,25 @@ function onMessage(msg, sender, respond) { browser.runtime.reload(); break; case OPEN_URLS_IN_TABS: - OpenUrlsInTabs(msg.tUrls); + openUrlsPromiseChain = openUrlsPromiseChain.then(() => { + return OpenUrlsInTabs(msg.tUrls); + }); + break; + case COPY_TO_CLIPBOARD: + CopyToClipboard(msg.tUrls); break; } } +/** + * @param {string[]} urls + * @return {Promise} + */ +async function CopyToClipboard(urls) { + let platformInfo = await browser.runtime.getPlatformInfo(); + navigator.clipboard.writeText(urls.join(platformInfo.os === chrome.runtime.PlatformOs.WIN ? '\r\n' : '\n')); +} + /** * @param {string[]} urls * @return {Promise} diff --git a/src/content-scripts/ActionMgr.js b/src/content-scripts/ActionMgr.js index 35ec6e3b..ad5d9c2f 100644 --- a/src/content-scripts/ActionMgr.js +++ b/src/content-scripts/ActionMgr.js @@ -12,7 +12,10 @@ class ActionMgr { if(Prefs.DevMode && Prefs.Dev_Skip_AllActions) return console.log('Skipped Copying Links: %o', links); - navigator.clipboard.writeText(links.join('\r\n')); + browser.runtime.sendMessage({ + Action: COPY_TO_CLIPBOARD, + tUrls: links, + }); } /** diff --git a/src/globals.js b/src/globals.js index 8967d3fd..ed589578 100644 --- a/src/globals.js +++ b/src/globals.js @@ -28,7 +28,8 @@ const OPEN_LINKS = 1, // Open links // Actions const BACKGROUND_TEST = 'BackgroundTest', RELOAD_EXTENSION = 'ReloadExtension', - OPEN_URLS_IN_TABS = 'OpenUrlsInTabs'; + OPEN_URLS_IN_TABS = 'OpenUrlsInTabs', + COPY_TO_CLIPBOARD = 'CopyToClipboard'; const TABS_OPEN_END = 'OpenTabsAtEnd', TABS_OPEN_RIGHT = 'OpenTabsToRight',