mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-09 00:52:30 -06:00
WebUI: switch to lightweight clipboard library
The new library [1] will opt to the modern Clipboard API [2] when it is available. It will fallback to the old method otherwise. The new library is also smaller and without any bloat. Note that the line `module.exports` is required to be removed/commented out. This is the only patch required. [1] https://github.com/feross/clipboard-copy [2] https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API PR #22792.
This commit is contained in:
@@ -277,17 +277,16 @@
|
||||
}
|
||||
});
|
||||
|
||||
new ClipboardJS("#CopyFeedURL", {
|
||||
text: () => {
|
||||
let joined = "";
|
||||
for (const rowID of rssFeedTable.selectedRows) {
|
||||
const row = rssFeedTable.getRow(rowID);
|
||||
if (row.full_data.dataUid !== "")
|
||||
joined += `${row.full_data.dataUrl}\n`;
|
||||
}
|
||||
return joined.slice(0, -1);
|
||||
document.getElementById("CopyFeedURL").addEventListener("click", async (event) => {
|
||||
let joined = "";
|
||||
for (const rowID of rssFeedTable.selectedRows) {
|
||||
const row = rssFeedTable.getRow(rowID);
|
||||
if (row.full_data.dataUid !== "")
|
||||
joined += `${row.full_data.dataUrl}\n`;
|
||||
}
|
||||
await clipboardCopy(joined.slice(0, -1));
|
||||
});
|
||||
|
||||
rssFeedTable.setup("rssFeedTableDiv", "rssFeedFixedHeaderDiv", rssFeedContextMenu);
|
||||
|
||||
const rssArticleContextMenu = new window.qBittorrent.ContextMenu.RssArticleContextMenu({
|
||||
|
||||
Reference in New Issue
Block a user