fix copy to clipboard not working in firefox

This commit is contained in:
Steffen 2021-01-07 20:50:59 +01:00
parent 7b1a264498
commit 84f73ceb01
2 changed files with 4 additions and 18 deletions

View File

@ -238,16 +238,9 @@ export default {
} }
}, },
copySessionUrl() { copySessionUrl() {
// check for clipboard permissions
navigator.permissions
.query({ name: "clipboard-write" })
.then(({ state }) => {
if (state === "granted" || state === "prompt") {
const url = window.location.href.split("#")[0]; const url = window.location.href.split("#")[0];
const link = url + "#" + this.session.sessionId; const link = url + "#" + this.session.sessionId;
navigator.clipboard.writeText(link); navigator.clipboard.writeText(link);
}
});
}, },
distributeRoles() { distributeRoles() {
if (this.session.isSpectator) return; if (this.session.isSpectator) return;

View File

@ -54,14 +54,7 @@ export default {
}, },
methods: { methods: {
copy: function() { copy: function() {
// check for clipboard permissions
navigator.permissions
.query({ name: "clipboard-write" })
.then(({ state }) => {
if (state === "granted" || state === "prompt") {
navigator.clipboard.writeText(this.input || this.gamestate); navigator.clipboard.writeText(this.input || this.gamestate);
}
});
}, },
load: function() { load: function() {
if (this.session.isSpectator) return; if (this.session.isSpectator) return;