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