Merge pull request #1571 from SchrodingersGat/clipboard-tweaks

Trim content when copying to clipboard
This commit is contained in:
Oliver 2021-05-11 08:39:14 +10:00 committed by GitHub
commit efec09e9a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,14 @@
function attachClipboard(selector) {
new ClipboardJS(selector, {
text: function(trigger) {
var content = trigger.parentElement.parentElement.textContent;
return content.trim();
}
});
}
function inventreeDocReady() {
/* Run this function when the HTML document is loaded.
* This will be called for every page that extends "base.html"
@ -50,11 +61,8 @@ function inventreeDocReady() {
});
// Initialize clipboard-buttons
new ClipboardJS('.clip-btn', {
text: function(trigger) {
return trigger.parentElement.parentElement.textContent;
}
});
attachClipboard('.clip-btn');
}
function isFileTransfer(transfer) {