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 = "";
},
copyConsole() {
navigator.clipboard.writeText(this.consoleBuffer).then(
() => {
console.log('clipboard successfully set');
},
() => {
console.error('clipboard write failed');
}
);
var input = document.createElement('textarea');
input.innerHTML = this.consoleBuffer;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
}
}
});