You could use a flow to pass the ID of the element you want to copy, to a script, and use a button to pass the ID to the flow. You could use the same flow to copy any part of the page (with an ID) - and the same flow/script for any pages.
For a repeat region, you would just need to pass the repeat ID (eg default 'repeat1). To copy individual records, you need to pass something like dmx-bind:id="id_{{$index}}"
Button (to copy multiple records/repeat):
<button id="copybtn1" class="btn btn-primary" dmx-on:click="flow1.run({toCopy: 'repeat1'})">copy all records</button>
Flow:
<script is="dmx-flow" id="flow1" type="text/dmx-flow">{
meta: {
$param: [
{type: "text", name: "toCopy"}
]
},
exec: {
steps: {
runJS: {
function: "copyToClpbrd",
args: ["{{$param.toCopy}}"],
name: "copyToClpbrd"
}
}
}
}</script>
Script:
<script>
function copyToClpbrd(p1) {
var copyText = document.getElementById(p1);
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(copyText);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand("Copy");
window.getSelection().removeAllRanges();
dmx.parse("notifies1.success('successfully copied')");
}</script>