Skip to content

Commit

Permalink
NBBIB-453 Replace copied citation line breaks with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
camilocodes committed Aug 14, 2024
1 parent 342f775 commit 3ca6596
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom/modules/nbbib_core/js/cite_copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
$(document).ready(function (e) {
// Transcription copy button.
$('#cite').click(function() {
navigator.clipboard.writeText($('.views-field-bibliographic-citation > .field-content').html().toString().replace(/<\/?[^>]+>/gi, '')).then(
// Copy html, convert to string,remove tags, replace breaks with spaces.
navigator.clipboard.writeText($('.views-field-bibliographic-citation > .field-content').html().toString().replace(/<\/?[^>]+>/gi, '').replace(/\n/g, " ")).then(
function() {
// Clipboard successfully set.
window.alert('Citation copied to clipboard')
Expand All @@ -18,6 +19,7 @@
);
});
$('.ui-dialog-titlebar-close').click(function(e) {
// Prevent default and reload on window close to reset.
e.preventDefault();
location.reload(true);
});
Expand Down

0 comments on commit 3ca6596

Please sign in to comment.