fix(clipboard): copy of multiple rules was broken

This commit is contained in:
Samuel Berthe 2021-05-01 21:20:41 +02:00
parent 135d4b7c1a
commit bbba46c41b
No known key found for this signature in database
GPG key ID: 64863511FFBD0E3C

View file

@ -3,14 +3,14 @@ $(function () {
text: function (trigger) {
const id = trigger.getAttribute('data-clipboard-target-id');
const html = $("#" + id + " .highlight");
return html.text();
return html.text() + '\n';
},
});
var clipboardCategories = new ClipboardJS('.clipboard-multiple', {
text: function (trigger) {
const id = trigger.getAttribute('data-clipboard-target-id');
const html = $("[id^=" + id + "] .highlight");
return html.append("\n\n").text();
return Array.from(html.map((i, target) => $(target).text())).join('\n\n');
},
});
});
});