Skip to content

Commit 3b5707f

Browse files
authored
Merge pull request #666 from mawinter69/JENKINS-70695
[JENKINS-70695] add copy to clipboard button for snippet generator
2 parents 9d3888c + e47101f commit 3b5707f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/handle-prototype.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ function handlePrototype(url, crumb) {
2121
if (response.ok) {
2222
response.text().then((responseText) => {
2323
document.getElementById('prototypeText').value = responseText;
24+
copybutton = document.querySelector('.jenkins-copy-button');
25+
copybutton.setAttribute("text", responseText);
26+
copybutton.classList.remove('jenkins-hidden');
2427
});
2528
}
2629
})

plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ THE SOFTWARE.
7373
data-url="${rootURL}/${it.GENERATE_URL}"
7474
data-crumb="${h.getCrumb(request)}"/>
7575
<f:textarea id="prototypeText" readonly="true" style="margin-top: 10px"/>
76+
<l:copyButton text="" clazz="jenkins-hidden jenkins-!-margin-top-1"/>
7677
<st:adjunct includes="org.jenkinsci.plugins.workflow.cps.Snippetizer.handle-prototype"/>
7778
</f:block>
7879
<f:section title="${%Global Variables}"/>

0 commit comments

Comments
 (0)