diff --git a/MyApp/wwwroot/mjs/app.mjs b/MyApp/wwwroot/mjs/app.mjs index bcf09ca..e95ae59 100644 --- a/MyApp/wwwroot/mjs/app.mjs +++ b/MyApp/wwwroot/mjs/app.mjs @@ -16,6 +16,19 @@ export async function remount() { }) } +/* used in :::sh and :::nuget CopyContainerRenderer */ +globalThis.copy = function (e) { + e.classList.add('copying') + let $el = document.createElement("textarea") + let text = (e.querySelector('code') || e.querySelector('p')).innerHTML + $el.innerHTML = text + document.body.appendChild($el) + $el.select() + document.execCommand("copy") + document.body.removeChild($el) + setTimeout(() => e.classList.remove('copying'), 3000) +} + document.addEventListener('DOMContentLoaded', () => Blazor.addEventListener('enhancedload', () => { remount()