diff --git a/ecc/blocks/ecc-dashboard/ecc-dashboard.js b/ecc/blocks/ecc-dashboard/ecc-dashboard.js index a6a00aff..99af733d 100644 --- a/ecc/blocks/ecc-dashboard/ecc-dashboard.js +++ b/ecc/blocks/ecc-dashboard/ecc-dashboard.js @@ -311,6 +311,7 @@ function initMoreOptions(props, config, eventObj, row) { const previewPre = buildTool(toolBox, 'Preview pre-event', 'preview-eye'); const previewPost = buildTool(toolBox, 'Preview post-event', 'preview-eye'); + const copyUrl = buildTool(toolBox, 'Copy URL', 'copy'); const edit = buildTool(toolBox, 'Edit', 'edit-pencil'); const clone = buildTool(toolBox, 'Clone', 'clone'); const deleteBtn = buildTool(toolBox, 'Delete', 'delete-wire-round'); @@ -353,9 +354,25 @@ function initMoreOptions(props, config, eventObj, row) { return '#'; })(); previewPost.target = '_blank'; + + copyUrl.addEventListener('click', (e) => { + let url; + try { + url = new URL(`${eventObj.detailPagePath}`); + } catch (err) { + url = new URL(`${getEventPageHost()}${eventObj.detailPagePath}`); + } + + if (url) { + e.preventDefault(); + navigator.clipboard.writeText(url.href); + showToast(props, config['copy-url-toast-msg'] || 'The URL has been added to the clipboard', { variant: 'positive', timeout: 6000 }); + } + }); } else { previewPre.classList.add('disabled'); previewPost.classList.add('disabled'); + copyUrl.classList.add('disabled'); } // edit diff --git a/ecc/icons/copy.svg b/ecc/icons/copy.svg new file mode 100644 index 00000000..6993553d --- /dev/null +++ b/ecc/icons/copy.svg @@ -0,0 +1,31 @@ + + + + + S Copy 18 N + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file