webapp: Workaround for copying console output to clipboard

Hint:: clipboard.writeText is only available when using https mode or access from localhost
This commit is contained in:
Thomas Basler 2022-12-30 21:33:27 +01:00
parent b72a98d5cd
commit 729632dc23

View File

@ -116,14 +116,12 @@ export default defineComponent({
this.consoleBuffer = ""; this.consoleBuffer = "";
}, },
copyConsole() { copyConsole() {
navigator.clipboard.writeText(this.consoleBuffer).then( var input = document.createElement('textarea');
() => { input.innerHTML = this.consoleBuffer;
console.log('clipboard successfully set'); document.body.appendChild(input);
}, input.select();
() => { document.execCommand('copy');
console.error('clipboard write failed'); document.body.removeChild(input);
}
);
} }
} }
}); });