summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BugModal/web/bug_modal.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index 09e7a81cf..babbdbe14 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -218,6 +218,27 @@ $(function() {
lb_show(this);
});
+ // when copying the bug id and summary, reformat to remove \n and alias
+ $(document).on(
+ 'copy', function(event) {
+ var selection = document.getSelection().toString().trim();
+ var match = selection.match(/^(Bug \d+)\s*\n(.+)$/)
+ || selection.match(/^(Bug \d+)\s+\([^\)]+\)\s*\n(.+)$/);
+ if (match) {
+ var content = match[1] + ' - ' + match[2].trim();
+ if (event.originalEvent.clipboardData) {
+ event.originalEvent.clipboardData.setData('text/plain', content);
+ }
+ else if (window.clipboardData) {
+ window.clipboardData.setData('Text', content);
+ }
+ else {
+ return;
+ }
+ event.preventDefault();
+ }
+ });
+
//
// anything after this point is only executed for logged in users
//