mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-07-13 15:14:49 -06:00
add fallback to all copy function
This commit is contained in:
parent
2369b925f7
commit
1db00b79bd
@ -90,6 +90,7 @@
|
||||
<script>
|
||||
import { useAppStore } from "@/store/app";
|
||||
import statusMapper from "@/helpers/mappers/status";
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
import instanceController from "@/services/instanceController";
|
||||
|
||||
export default {
|
||||
@ -105,7 +106,9 @@ export default {
|
||||
methods: {
|
||||
copyApikey() {
|
||||
if (this.copied) return;
|
||||
navigator.clipboard.writeText(this.instance.instance.apikey);
|
||||
|
||||
copyToClipboard(this.instance.instance.apikey);
|
||||
|
||||
this.copied = true;
|
||||
setTimeout(() => {
|
||||
this.copied = false;
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
<script>
|
||||
import instanceController from "@/services/instanceController";
|
||||
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
export default {
|
||||
name: "MyChats",
|
||||
props: {
|
||||
@ -113,12 +113,7 @@ export default {
|
||||
copy(group) {
|
||||
if (this.copied.includes(group.id)) return;
|
||||
|
||||
const el = document.createElement("textarea");
|
||||
el.value = group.id;
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(el);
|
||||
copyToClipboard(group.id);
|
||||
|
||||
this.copied.push(group.id);
|
||||
setTimeout(() => {
|
||||
|
@ -98,7 +98,7 @@
|
||||
|
||||
<script>
|
||||
import instanceController from "@/services/instanceController";
|
||||
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
export default {
|
||||
name: "MyChats",
|
||||
props: {
|
||||
@ -129,12 +129,7 @@ export default {
|
||||
copy(group) {
|
||||
if (this.copied.includes(group.id)) return;
|
||||
|
||||
const el = document.createElement("textarea");
|
||||
el.value = group.id;
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(el);
|
||||
copyToClipboard(group.id);
|
||||
|
||||
this.copied.push(group.id);
|
||||
setTimeout(() => {
|
||||
|
@ -96,7 +96,7 @@
|
||||
<script>
|
||||
import instanceController from "@/services/instanceController";
|
||||
import GroupModal from "../../modal/GroupModal.vue";
|
||||
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
|
||||
export default {
|
||||
name: "MyGroups",
|
||||
@ -127,12 +127,7 @@ export default {
|
||||
copy(group) {
|
||||
if (this.copied.includes(group.id)) return;
|
||||
|
||||
const el = document.createElement("textarea");
|
||||
el.value = group.id;
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(el);
|
||||
copyToClipboard(group.id);
|
||||
|
||||
this.copied.push(group.id);
|
||||
setTimeout(() => {
|
||||
|
@ -78,7 +78,7 @@
|
||||
|
||||
<script>
|
||||
import { useAppStore } from "@/store/app";
|
||||
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
export default {
|
||||
name: "SettingsModal",
|
||||
data: () => ({
|
||||
@ -94,7 +94,8 @@ export default {
|
||||
this.dialog = true;
|
||||
},
|
||||
copyValue(key) {
|
||||
navigator.clipboard.writeText(this[key]);
|
||||
copyToClipboard(this[key]);
|
||||
|
||||
this.copy[key] = true;
|
||||
setTimeout(() => {
|
||||
this.copy[key] = false;
|
||||
|
@ -28,6 +28,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
|
||||
export default {
|
||||
name: "SettingsModal",
|
||||
data: () => ({
|
||||
@ -39,9 +41,9 @@ export default {
|
||||
methods: {
|
||||
copy() {
|
||||
if (this.copied) return;
|
||||
if (!navigator.clipboard)
|
||||
return alert("Seu navegador não suporta a função de copiar texto.");
|
||||
navigator.clipboard.writeText(this.key);
|
||||
|
||||
copyToClipboard(this.key);
|
||||
|
||||
this.copied = true;
|
||||
setTimeout(() => {
|
||||
this.copied = false;
|
||||
|
@ -44,6 +44,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import copyToClipboard from "@/helpers/copyToClipboard";
|
||||
export default {
|
||||
name: "SettingsModal",
|
||||
data: () => ({
|
||||
@ -54,15 +55,13 @@ export default {
|
||||
methods: {
|
||||
copy() {
|
||||
if (this.copied) return;
|
||||
if (!navigator.clipboard)
|
||||
return alert("Seu navegador não suporta a função de copiar texto.");
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const connection = JSON.stringify(this.connection);
|
||||
const base64 = btoa(connection);
|
||||
url.searchParams.set("connection", base64);
|
||||
|
||||
navigator.clipboard.writeText(url.href);
|
||||
copyToClipboard(url.href);
|
||||
|
||||
this.copied = true;
|
||||
setTimeout(() => {
|
||||
this.copied = false;
|
||||
|
15
src/helpers/copyToClipboard.js
Normal file
15
src/helpers/copyToClipboard.js
Normal file
@ -0,0 +1,15 @@
|
||||
export default (value) => {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(value);
|
||||
} else {
|
||||
const el = document.createElement("textarea");
|
||||
el.value = value;
|
||||
el.setAttribute("readonly", "");
|
||||
el.style.position = "absolute";
|
||||
el.style.left = "-9999px";
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(el);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user