diff --git a/assets/js/message-permalink.js b/assets/js/message-permalink.js new file mode 100644 index 0000000000..97f7f637ea --- /dev/null +++ b/assets/js/message-permalink.js @@ -0,0 +1,11 @@ +(function() { + 'use strict' + + $('.topic-message').on('click', '[data-copy-permalink]', function(e) { + e.stopPropagation() + e.preventDefault() + navigator.clipboard.writeText($(this).attr('data-copy-permalink')) + const dropdown = e.target.closest('.dropdown') + dropdown.removeAttribute('open') + }) +})(jQuery) diff --git a/templates/misc/message.part.html b/templates/misc/message.part.html index d67e32f7f7..9d9b3d7c36 100644 --- a/templates/misc/message.part.html +++ b/templates/misc/message.part.html @@ -142,6 +142,11 @@ {% endif %} +