Last active
April 27, 2021 22:38
-
-
Save rymndhng/13ac783007c3912dfd00c35bb3e8eeb3 to your computer and use it in GitHub Desktop.
JIRA Issue Bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { | |
"support old jira first"; | |
const descriptionElement = document.getElementById("description"); | |
if (descriptionElement) { | |
descriptionElement.value = "*What*:\n\n*Why*:\n\n*What does success look like?*\n\n*Testing Notes*\n\n*Technical Notes/Hints*\n\n"; | |
return; | |
} | |
"support new jira issue view"; | |
const proseMirrorElement = document.getElementsByClassName("ProseMirror")[0]; | |
if (proseMirrorElement) { | |
const evt = new ClipboardEvent("paste"); | |
evt.clipboardData.items.add("**What**: *The thing we're trying to do*\n\n**Why**: *what's the rationale for doing this? What is the motivating reason for this work?* \n\n**What does success look like?**\n- *What are all the technical items we need to address*\n\n**Testing Notes**\n- *What are the steps a tester needs to do to verify this change?*\n\n**Technical Notes/Hints**\n- *What contextual information would help drive the implementation?*\n\n", "text/plain"); | |
proseMirrorElement.dispatchEvent(evt); | |
return; | |
} | |
alert("Unable to find a JIRA Issue Description on this page!"); | |
})(); |
Hey, glad you found use for the script -- I don't actively use this script anymore. I also don't use Chrome, so I don't know what the quirks are across browsers. The script seems to work fine in Firefox.
I used this source as a reference to this script.
Good luck!
@ds-clearago -- I gave the script a try today on Firefox and it still works. The issue you're encountering might be Chrome specific
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now that JIRA phased out the old issue view, I was trying this on Jira Cloud new issue view on 25.04.2021 with Chrome Version 90.0.4430.85 on Mac OS 10.15.7 but I can't seem to be able to add the ClipboardEvent.
I can't figure this out even after reading https://www.w3.org/TR/clipboard-apis/
Previously, I already had changed
$(".ProseMirror")
from your script todocument.getElementsByClassName("ProseMirror")
as I was gettingUncaught ReferenceError: $ is not defined
... Do you know what might be wrong? Cheers, Dennis